Commit 4c66544f authored by Jérome Perrin's avatar Jérome Perrin

officejs_support_request_ui: return the preferred editor in the form definition

This is better than getting it in another HTTP request.
parent ecaa597a
...@@ -82,6 +82,7 @@ ...@@ -82,6 +82,7 @@
.push(function (gadgets) { .push(function (gadgets) {
var form_options = gadget.state.erp5_form, var form_options = gadget.state.erp5_form,
rendered_form = gadget.state.erp5_document._embedded._view, rendered_form = gadget.state.erp5_document._embedded._view,
preferred_editor = rendered_form.your_preferred_editor.default,
rendered_field, rendered_field,
key, key,
editor = gadgets[0], editor = gadgets[0],
...@@ -102,32 +103,25 @@ ...@@ -102,32 +103,25 @@
form_options.erp5_document = gadget.state.erp5_document; form_options.erp5_document = gadget.state.erp5_document;
form_options.form_definition = gadget.state.form_definition; form_options.form_definition = gadget.state.form_definition;
form_options.view = gadget.state.view; form_options.view = gadget.state.view;
return new RSVP.Queue()
return gadget.jio_getAttachment( .push(
'post_module', function () {
gadget.hateoas_url + gadget.options.jio_key + "/Base_getEditorFieldPreferredTextEditor", return RSVP.all([
{format: "text"} erp5_form.render(form_options),
).push(function (preferred_editor) { editor.render({
return new RSVP.Queue() value: "",
.push( key: "comment",
function () { portal_type: "HTML Post",
return RSVP.all([ editable: true,
erp5_form.render(form_options), editor: preferred_editor
editor.render({ })]);
value: "", }
key: "comment", ).push(function () {
portal_type: "HTML Post", // make our submit button editable
editable: true, var element = gadget.element.querySelector('input[type="submit"]');
editor: preferred_editor element.removeAttribute('disabled');
})]); element.classList.remove('ui-disabled');
} });
).push(function () {
// make our submit button editable
var element = gadget.element.querySelector('input[type="submit"]');
element.removeAttribute('disabled');
element.classList.remove('ui-disabled');
});
});
}) })
// render the header // render the header
......
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1539132630.18</float> <float>1539135182.86</float>
<string>GMT+9</string> <string>GMT+9</string>
</tuple> </tuple>
</state> </state>
......
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
<string>my_source_decision_title</string> <string>my_source_decision_title</string>
<string>my_source_project_title</string> <string>my_source_project_title</string>
<string>my_destination_title</string> <string>my_destination_title</string>
<string>your_preferred_editor</string>
</list> </list>
</value> </value>
</item> </item>
......
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