Commit b197d681 authored by Roque's avatar Roque

erp5_web_renderjs_ui: control on when to apply "select items renderjs-ui workaround"

- that workaround doesn't work on officejs apps
- only apply for now to text editor
parent 5edc88f8
...@@ -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,23 @@ ...@@ -111,10 +112,23 @@
}) })
.onStateChange(function onStateChange() { .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 RSVP.all([
form_gadget.getSetting('portal_type'),
form_gadget.getSetting('document_title'),
form_gadget.getSetting('parent_portal_type')
]);
})
.push(function (result_list) {
// XXX Disable select and clipboard functionalities on migrated apps: 'uid'-workaround made for renderjs UI doesn't work on officejs
hide_enabled = result_list[0] !== "Web Page" || result_list[1] !== "Text Document" || result_list[2] !== "Web Page Module";
// 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;
...@@ -126,9 +140,7 @@ ...@@ -126,9 +140,7 @@
// XXX Hardcoded for listbox's hide/configure functionalities // XXX Hardcoded for listbox's hide/configure functionalities
form_options.form_definition.configure_enabled = true; form_options.form_definition.configure_enabled = true;
// XXX Disable select and clipboard functionalities: 'uid'-workaround made for renderjs UI doesn't work on officejs form_options.form_definition.hide_enabled = hide_enabled;
// TODO: ask if officejs app or regular renderjs ui
form_options.form_definition.hide_enabled = false;
// XXX not generic, fix later // XXX not generic, fix later
if (form_gadget.state.extended_search) { if (form_gadget.state.extended_search) {
......
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