Commit 368bc2d7 authored by Roque's avatar Roque

erp5_web_renderjs_ui: disable listbox select buttons on officejs apps

parent 632bcaf8
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>975.34836.41174.41949</string> </value>
<value> <string>976.52707.23546.23773</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1557147532.09</float>
<float>1563368262.77</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -342,6 +342,7 @@
"triggerListboxSelectAction")
.declareAcquiredMethod("triggerListboxClipboardAction",
"triggerListboxClipboardAction")
.declareAcquiredMethod("getSetting", "getSetting")
//////////////////////////////////////////////
// initialize the gadget content
......@@ -512,6 +513,10 @@
'button[name="Clipboard"]',
'button[name="Configure"]',
'button[name="SelectRows"]'],
url_for_option_list = [],
is_sortable_list = [],
select_list,
hide_buttons,
button;
/*
......@@ -606,10 +611,7 @@
column,
is_sortable,
current_sort,
options,
url_for_option_list = [],
is_sortable_list = [],
select_list;
options;
for (k = 0; k < column_list.length; k += 1) {
column = column_list[k];
......@@ -652,7 +654,11 @@
throw error;
});
}
return gadget.getSetting('hide_listbox_buttons');
})
.push(function (hide_listbox_buttons) {
// XXX Disable select and clipboard functionalities on migrated apps: 'uid'-workaround made for renderjs UI doesn't work on officejs
hide_buttons = ((hide_listbox_buttons !== undefined && hide_listbox_buttons == "1") ? true : false);
return RSVP.all([
gadget.getUrlForList(url_for_option_list),
is_sortable_list,
......@@ -769,9 +775,11 @@
button_element.setAttribute('data-rel', 'clipboard');
button_element.setAttribute('name', 'Clipboard');
button_element.type = 'button';
button_element.setAttribute('class', 'ui-icon-list-ul ui-btn-icon-left ');
button_element.setAttribute('class', 'ui-icon-list-ul ui-btn-icon-left ' + gadget.state.hide_class);
button_element.textContent = translation_list[5];
div_element.appendChild(button_element);
if (!hide_buttons) {
div_element.appendChild(button_element);
}
// Add Select button
// <button {{disabled}} data-rel="hide" data-i18n="Select" name="Hide" type="button" class="ui-icon-check-square-o ui-btn-icon-left {{hide_class}}"></button>
......@@ -782,7 +790,9 @@
button_element.type = 'button';
button_element.setAttribute('class', 'ui-icon-check-square-o ui-btn-icon-left ' + gadget.state.hide_class);
button_element.textContent = translation_list[1];
div_element.appendChild(button_element);
if (!hide_buttons) {
div_element.appendChild(button_element);
}
}
fragment.appendChild(div_element);
......@@ -1182,7 +1192,6 @@
if (gadget.state.show_count === true) {
aggregation_option_list.push("count");
}
return gadget.jio_allDocs({
// XXX Not jIO compatible, but until a better api is found...
"list_method_template": this.state.list_method_template,
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>977.11616.36565.47718</string> </value>
<value> <string>977.7896.61696.31214</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1563530945.78</float>
<float>1563307776.79</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -74,6 +74,7 @@
.declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("renderEditorPanel", "renderEditorPanel")
.declareAcquiredMethod("getTranslationList", "getTranslationList")
.declareAcquiredMethod("getSetting", "getSetting")
/////////////////////////////////////////////////////////////////
// Proxy methods to the child gadget
......@@ -111,10 +112,18 @@
})
.onStateChange(function onStateChange() {
var form_gadget = this;
var form_gadget = this, hide_enabled;
// render the erp5 form
return form_gadget.getDeclaredGadget("erp5_form")
return RSVP.Queue()
.push(function () {
return form_gadget.getSetting('hide_listbox_buttons');
})
.push(function (hide_listbox_buttons) {
// XXX Disable select and clipboard functionalities on migrated apps: 'uid'-workaround made for renderjs UI doesn't work on officejs
hide_enabled = ((hide_listbox_buttons !== undefined && hide_listbox_buttons == "1") ? false : true);
// render the erp5 form
return form_gadget.getDeclaredGadget("erp5_form");
})
.push(function (erp5_form) {
var form_options = form_gadget.state.erp5_form;
......@@ -125,8 +134,8 @@
form_options.editable = form_gadget.state.editable;
// XXX Hardcoded for listbox's hide/configure functionalities
form_options.form_definition.hide_enabled = true;
form_options.form_definition.configure_enabled = true;
form_options.form_definition.hide_enabled = hide_enabled;
// XXX not generic, fix later
if (form_gadget.state.extended_search) {
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>974.48375.47521.35942</string> </value>
<value> <string>977.7261.25868.10427</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1554113017.67</float>
<float>1563269623.68</float>
<string>UTC</string>
</tuple>
</state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment