Merge branch 'master' into 1971-show-image-thumbnails
[arvados.git] / apps / workbench / app / assets / javascripts / editable.js
1 $.fn.editable.defaults.ajaxOptions = {type: 'put', dataType: 'json'};
2 $.fn.editable.defaults.send = 'always';
3
4 // Default for editing is popup.  I experimented with inline which is a little
5 // nicer in that it shows up right under the mouse instead of nearby.  However,
6 // the inline box is taller than the regular content, which causes the page
7 // layout to shift unless we make the table rows tall, which leaves a lot of
8 // wasted space when not editing.  Also inline can get cut off if the page is
9 // too narrow, when the popup box will just move to do the right thing.
10 //$.fn.editable.defaults.mode = 'inline';
11
12 $.fn.editable.defaults.params = function (params) {
13     var a = {};
14     var key = params.pk.key;
15     a.id = params.pk.id;
16     a[key] = {};
17     a[key][params.name] = params.value;
18     return a;
19 };
20
21 $.fn.editable.defaults.validate = function (value) {
22     if (value == "***invalid***") {
23         return "Invalid selection";
24     }
25 }
26
27 $.fn.editabletypes.text.defaults.tpl = '<input type="text" name="editable-text">'
28
29 $.fn.editableform.buttons = '\
30 <button type="submit" class="btn btn-primary btn-sm editable-submit" \
31   id="editable-submit"><i class="glyphicon glyphicon-ok"></i></button>\
32 <button type="button" class="btn btn-default btn-sm editable-cancel" \
33   id="editable-cancel"><i class="glyphicon glyphicon-remove"></i></button>\
34 '