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 @@
"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];
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,8 +790,10 @@
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];
if (!hide_buttons) {
div_element.appendChild(button_element);
}
}
fragment.appendChild(div_element);
table_element.innerHTML = '<thead class="thead"><tr></tr></thead><tbody></tbody><tfoot></tfoot>';
......@@ -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.17471.41864.29440</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1563530945.78</float>
<float>1563892414.77</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;
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")
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