Commit 2a3f4c11 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_web_renderjs_ui: Extend code to support submit dialog with custom method

parent 8e39f2fe
...@@ -152,171 +152,183 @@ ...@@ -152,171 +152,183 @@
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>publish_alive</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>publish_alive</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>romain</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>romain</string> </value>
<key> <string>comment</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>comment</string> </key>
<item> <value> <string></string> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1406903306.78</float> <state>
<string>GMT</string> <tuple>
</tuple> <float>1406903306.78</float>
</state> <string>GMT</string>
</object> </tuple>
</value> </state>
</item> </object>
<item> </value>
<key> <string>validation_state</string> </key> </item>
<value> <string>published_alive</string> </value> <item>
</item> <key> <string>validation_state</string> </key>
</dictionary> <value> <string>published_alive</string> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>edit</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>edit</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>zope</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>zope</string> </value>
<key> <string>comment</string> </key> </item>
<value> <item>
<none/> <key> <string>comment</string> </key>
</value> <value>
</item> <none/>
<item> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>976.23831.58029.7424</string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>976.23831.58029.7424</string> </value>
<key> <string>state</string> </key> </item>
<value> <string>current</string> </value> <item>
</item> <key> <string>state</string> </key>
<item> <value> <string>current</string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1560418147.64</float> <state>
<string>UTC</string> <tuple>
</tuple> <float>1560418147.64</float>
</state> <string>UTC</string>
</object> </tuple>
</value> </state>
</item> </object>
</dictionary> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="5" aka="AAAAAAAAAAU=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
<pickle> <pickle>
<tuple> <dictionary>
<none/> <item>
<list> <key> <string>_log</string> </key>
<dictionary> <value>
<item> <list>
<key> <string>action</string> </key> <dictionary>
<value> <string>detect_converted_file</string> </value> <item>
</item> <key> <string>action</string> </key>
<item> <value> <string>detect_converted_file</string> </value>
<key> <string>actor</string> </key> </item>
<value> <string>romain</string> </value> <item>
</item> <key> <string>actor</string> </key>
<item> <value> <string>romain</string> </value>
<key> <string>comment</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>comment</string> </key>
<item> <value> <string></string> </value>
<key> <string>error_message</string> </key> </item>
<value> <string></string> </value> <item>
</item> <key> <string>error_message</string> </key>
<item> <value> <string></string> </value>
<key> <string>external_processing_state</string> </key> </item>
<value> <string>converted</string> </value> <item>
</item> <key> <string>external_processing_state</string> </key>
<item> <value> <string>converted</string> </value>
<key> <string>serial</string> </key> </item>
<value> <string>0.0.0.0</string> </value> <item>
</item> <key> <string>serial</string> </key>
<item> <value> <string>0.0.0.0</string> </value>
<key> <string>time</string> </key> </item>
<value> <item>
<object> <key> <string>time</string> </key>
<klass> <value>
<global name="DateTime" module="DateTime.DateTime"/> <object>
</klass> <klass>
<tuple> <global name="DateTime" module="DateTime.DateTime"/>
<none/> </klass>
</tuple> <tuple>
<state> <none/>
<tuple> </tuple>
<float>1406902506.2</float> <state>
<string>GMT</string> <tuple>
</tuple> <float>1406902506.2</float>
</state> <string>GMT</string>
</object> </tuple>
</value> </state>
</item> </object>
</dictionary> </value>
</list> </item>
</tuple> </dictionary>
</list>
</value>
</item>
</dictionary>
</pickle> </pickle>
</record> </record>
</ZopeData> </ZopeData>
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
}); });
} }
function submitDialog(is_updating) { function submitDialog(is_updating, custom_dialog_method) {
var gadget = this, var gadget = this,
button_container = button_container =
gadget.element.querySelector('.dialog_button_container'), gadget.element.querySelector('.dialog_button_container'),
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
} }
} }
// ERP5 expects target Script name in dialog_method field // ERP5 expects target Script name in dialog_method field
data.dialog_method = gadget.state.form_definition.action; data.dialog_method = custom_dialog_method || gadget.state.form_definition.action;
// For Update Action - override the default value from "action" // For Update Action - override the default value from "action"
if (is_updating) { if (is_updating) {
data.dialog_method = gadget.state.form_definition.update_action; data.dialog_method = gadget.state.form_definition.update_action;
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
if (gadget.state.redirect_to_parent) { if (gadget.state.redirect_to_parent) {
return gadget.redirect({command: 'history_previous'}); return gadget.redirect({command: 'history_previous'});
} }
console.log('COSUCOUS', result);
if ((gadget.state.jio_key === result.jio_key) && if ((gadget.state.jio_key === result.jio_key) &&
(!result.view)) { (!result.view)) {
// don't update navigation history when not really redirecting // don't update navigation history when not really redirecting
...@@ -107,7 +106,6 @@ ...@@ -107,7 +106,6 @@
} }
} }
console.log('lets redirect', command, result.jio_key, result.view);
// forced document change thus we update history // forced document change thus we update history
return gadget.redirect({ return gadget.redirect({
command: command, command: command,
...@@ -131,6 +129,10 @@ ...@@ -131,6 +129,10 @@
} }
function submitDialogWithCustomDialogMethod(param_list) {
return submitDialog.apply(this, [false, param_list[0]]);
}
var gadget_klass = rJS(window), var gadget_klass = rJS(window),
dialog_button_source = gadget_klass.__template_element dialog_button_source = gadget_klass.__template_element
.getElementById("dialog-button-template") .getElementById("dialog-button-template")
...@@ -153,6 +155,8 @@ ...@@ -153,6 +155,8 @@
.declareAcquiredMethod("translate", "translate") .declareAcquiredMethod("translate", "translate")
.declareAcquiredMethod("translateHtml", "translateHtml") .declareAcquiredMethod("translateHtml", "translateHtml")
.declareAcquiredMethod("submitContent", "submitContent") .declareAcquiredMethod("submitContent", "submitContent")
.allowPublicAcquisition("submitDialogWithCustomDialogMethod",
submitDialogWithCustomDialogMethod)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Proxy methods to the child gadget // Proxy methods to the child gadget
......
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