Commit a3570075 authored by Roque's avatar Roque

[erp5_web_renderjs_ui] Hide select buttons on listbox for officejs apps

- there is a workaround on this views for renderjs UI that uses guid values of elements. This doesn't work on officejs apps, so for now this buttons are hide
parent dccc1f22
...@@ -342,6 +342,7 @@ ...@@ -342,6 +342,7 @@
"triggerListboxSelectAction") "triggerListboxSelectAction")
.declareAcquiredMethod("triggerListboxClipboardAction", .declareAcquiredMethod("triggerListboxClipboardAction",
"triggerListboxClipboardAction") "triggerListboxClipboardAction")
.declareAcquiredMethod("getSetting", "getSetting")
////////////////////////////////////////////// //////////////////////////////////////////////
// initialize the gadget content // initialize the gadget content
...@@ -512,6 +513,10 @@ ...@@ -512,6 +513,10 @@
'button[name="Clipboard"]', 'button[name="Clipboard"]',
'button[name="Configure"]', 'button[name="Configure"]',
'button[name="SelectRows"]'], 'button[name="SelectRows"]'],
url_for_option_list = [],
is_sortable_list = [],
select_list,
hide_buttons,
button; button;
/* /*
...@@ -606,10 +611,7 @@ ...@@ -606,10 +611,7 @@
column, column,
is_sortable, is_sortable,
current_sort, current_sort,
options, options;
url_for_option_list = [],
is_sortable_list = [],
select_list;
for (k = 0; k < column_list.length; k += 1) { for (k = 0; k < column_list.length; k += 1) {
column = column_list[k]; column = column_list[k];
...@@ -652,7 +654,11 @@ ...@@ -652,7 +654,11 @@
throw error; 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([ return RSVP.all([
gadget.getUrlForList(url_for_option_list), gadget.getUrlForList(url_for_option_list),
is_sortable_list, is_sortable_list,
...@@ -769,9 +775,11 @@ ...@@ -769,9 +775,11 @@
button_element.setAttribute('data-rel', 'clipboard'); button_element.setAttribute('data-rel', 'clipboard');
button_element.setAttribute('name', 'Clipboard'); button_element.setAttribute('name', 'Clipboard');
button_element.type = 'button'; 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]; button_element.textContent = translation_list[5];
div_element.appendChild(button_element); if (!hide_buttons) {
div_element.appendChild(button_element);
}
// Add Select button // 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> // <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 @@ ...@@ -782,7 +790,9 @@
button_element.type = 'button'; button_element.type = 'button';
button_element.setAttribute('class', 'ui-icon-check-square-o ui-btn-icon-left ' + gadget.state.hide_class); button_element.setAttribute('class', 'ui-icon-check-square-o ui-btn-icon-left ' + gadget.state.hide_class);
button_element.textContent = translation_list[1]; button_element.textContent = translation_list[1];
div_element.appendChild(button_element); if (!hide_buttons) {
div_element.appendChild(button_element);
}
} }
fragment.appendChild(div_element); fragment.appendChild(div_element);
...@@ -1182,7 +1192,6 @@ ...@@ -1182,7 +1192,6 @@
if (gadget.state.show_count === true) { if (gadget.state.show_count === true) {
aggregation_option_list.push("count"); aggregation_option_list.push("count");
} }
return gadget.jio_allDocs({ return gadget.jio_allDocs({
// XXX Not jIO compatible, but until a better api is found... // XXX Not jIO compatible, but until a better api is found...
"list_method_template": this.state.list_method_template, "list_method_template": this.state.list_method_template,
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>977.11616.36565.47718</string> </value> <value> <string>977.17471.41864.29440</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1563530945.78</float> <float>1563892414.77</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("renderEditorPanel", "renderEditorPanel") .declareAcquiredMethod("renderEditorPanel", "renderEditorPanel")
.declareAcquiredMethod("getTranslationList", "getTranslationList") .declareAcquiredMethod("getTranslationList", "getTranslationList")
.declareAcquiredMethod("getSetting", "getSetting")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Proxy methods to the child gadget // Proxy methods to the child gadget
...@@ -111,10 +112,18 @@ ...@@ -111,10 +112,18 @@
}) })
.onStateChange(function onStateChange() { .onStateChange(function onStateChange() {
var form_gadget = this; var form_gadget = this, hide_enabled;
// render the erp5 form return RSVP.Queue()
return form_gadget.getDeclaredGadget("erp5_form") .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) { .push(function (erp5_form) {
var form_options = form_gadget.state.erp5_form; var form_options = form_gadget.state.erp5_form;
...@@ -125,8 +134,8 @@ ...@@ -125,8 +134,8 @@
form_options.editable = form_gadget.state.editable; form_options.editable = form_gadget.state.editable;
// XXX Hardcoded for listbox's hide/configure functionalities // 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.configure_enabled = true;
form_options.form_definition.hide_enabled = hide_enabled;
// XXX not generic, fix later // XXX not generic, fix later
if (form_gadget.state.extended_search) { if (form_gadget.state.extended_search) {
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>974.48375.47521.35942</string> </value> <value> <string>977.7261.25868.10427</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1554113017.67</float> <float>1563269623.68</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </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