Commit 204cbcb2 authored by Roque's avatar Roque

erp5_officejs: minor fix in reply post redirect

parent 9232aff1
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
var gadget = this, var gadget = this,
child_gadget_url = 'gadget_erp5_pt_form_view_editable.html', child_gadget_url = 'gadget_erp5_pt_form_view_editable.html',
portal_type, parent_portal_type, portal_type, parent_portal_type,
parent_relative_url, form_definition, action_type; parent_relative_url, form_definition,
action_type, custom_code;
return RSVP.Queue() return RSVP.Queue()
.push(function () { .push(function () {
return RSVP.all([ return RSVP.all([
...@@ -60,7 +61,8 @@ ...@@ -60,7 +61,8 @@
// custom code will come from configuration side (action form) // custom code will come from configuration side (action form)
if (action_type === "object_jio_js_script") { if (action_type === "object_jio_js_script") {
if (form_definition.fields_raw_properties.hasOwnProperty("gadget_field_action_js_script")) { if (form_definition.fields_raw_properties.hasOwnProperty("gadget_field_action_js_script")) {
eval(form_definition.fields_raw_properties.gadget_field_action_js_script.values.renderjs_extra[0][0]); custom_code = form_definition.fields_raw_properties.gadget_field_action_js_script.values.renderjs_extra[0];
eval(custom_code[0]);
} }
} }
return gadget_utils.createDocument(doc_options); return gadget_utils.createDocument(doc_options);
...@@ -84,30 +86,41 @@ ...@@ -84,30 +86,41 @@
}); });
} }
if (action_reference === "reply") { if (action_reference === "reply") {
var parent_document, child_document, child_jio_key; return gadget_utils.getFormDefinition(parent_portal_type, action_reference)
return gadget.jio_get(options.jio_key)
.push(function (result) { .push(function (result) {
parent_document = result;
return gadget_utils.getFormDefinition(parent_document.portal_type, action_reference);
})
.push(function (result) {
var title = parent_document.title;
form_definition = result; form_definition = result;
if (!title.startsWith("Re: ")) { // custom code will come from configuration side (action form)
title = "Re: " + parent_document.title; if (action_type === "object_jio_js_script") {
if (form_definition.fields_raw_properties.hasOwnProperty("gadget_field_action_js_script")) {
custom_code = form_definition.fields_raw_properties.gadget_field_action_js_script.values.renderjs_extra[0];
eval(custom_code[0]);
}
} }
return gadget.changeState({ var parent_document, child_document, child_jio_key;
doc: {title: title}, return gadget.jio_get(options.jio_key)
parent_document: parent_document, .push(function (result) {
child_gadget_url: child_gadget_url, parent_document = result;
form_definition: form_definition, return gadget_utils.getFormDefinition(parent_document.portal_type, action_reference);
view: action_reference, })
//HARDCODED: following fields should be indicated by the configuration .push(function (result) {
editable: true, var title = parent_document.title;
has_more_views: false, form_definition = result;
has_more_actions: false, if (!title.startsWith("Re: ")) {
is_form_list: false title = "Re: " + parent_document.title;
}); }
return gadget.changeState({
doc: {title: title},
parent_document: parent_document,
child_gadget_url: child_gadget_url,
form_definition: form_definition,
view: action_reference,
//HARDCODED: following fields should be indicated by the configuration
editable: true,
has_more_views: false,
has_more_actions: false,
is_form_list: false
});
});
}); });
} }
throw "Action " + action_reference + " not implemented yet"; throw "Action " + action_reference + " not implemented yet";
...@@ -147,7 +160,8 @@ ...@@ -147,7 +160,8 @@
} }
} }
return gadget_utils.createDocument(document) return gadget_utils.createDocument(document)
.push(function (jio_key) { .push(function (id) {
jio_key = id;
return gadget.notifySubmitting(); return gadget.notifySubmitting();
}) })
.push(function () { .push(function () {
......
...@@ -269,7 +269,7 @@ ...@@ -269,7 +269,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>975.4605.37710.17527</string> </value> <value> <string>975.4704.7332.52360</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -287,7 +287,7 @@ ...@@ -287,7 +287,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1555418811.51</float> <float>1555424781.77</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