Commit b1798eab authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Add a new 'push_history' URL command

This is an adhoc URL command to support creation of new ERP5 document while keeping the global history usable.
Clicking on the 'back' icon on the newly created document will redirect to the parent document.
parent d6f92556
......@@ -269,7 +269,7 @@
}\n
return RSVP.all([\n
form_gadget.notifySubmitted(),\n
form_gadget.redirect({command: \'display\', options: {jio_key: new URI(location).segment(2), editable: form_gadget.props.editable}})\n
form_gadget.redirect({command: \'push_history\', options: {jio_key: new URI(location).segment(2), editable: form_gadget.props.editable}})\n
]);\n
});\n
}\n
......@@ -420,7 +420,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.30291.61878.2013</string> </value>
<value> <string>946.39113.715.59340</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -438,7 +438,7 @@
</tuple>
<state>
<tuple>
<float>1445000905.46</float>
<float>1445530221.33</float>
<string>GMT</string>
</tuple>
</state>
......
......@@ -131,6 +131,7 @@
COMMAND_SELECTION_PREVIOUS = "selection_previous",\n
COMMAND_SELECTION_NEXT = "selection_next",\n
COMMAND_HISTORY_PREVIOUS = "history_previous",\n
COMMAND_PUSH_HISTORY = "push_history",\n
VALID_URL_COMMAND_DICT = {};\n
VALID_URL_COMMAND_DICT[COMMAND_DISPLAY_STATE] = null;\n
VALID_URL_COMMAND_DICT[COMMAND_CHANGE_STATE] = null;\n
......@@ -138,6 +139,7 @@
VALID_URL_COMMAND_DICT[COMMAND_SELECTION_PREVIOUS] = null;\n
VALID_URL_COMMAND_DICT[COMMAND_SELECTION_NEXT] = null;\n
VALID_URL_COMMAND_DICT[COMMAND_HISTORY_PREVIOUS] = null;\n
VALID_URL_COMMAND_DICT[COMMAND_PUSH_HISTORY] = null;\n
\n
//////////////////////////////////////////////////////////////////\n
// Change URL functions\n
......@@ -323,6 +325,21 @@
);\n
});\n
}\n
\n
function execPushHistoryCommand(gadget, previous_options, next_options) {\n
var jio_key = next_options.jio_key;\n
delete next_options.jio_key;\n
// XXX Hack to support create dialog\n
delete previous_options.view;\n
delete previous_options.page;\n
return addHistory(gadget, previous_options)\n
.push(function (id) {\n
next_options.history = id;\n
return synchronousChangeState(\n
getDisplayUrlFor(jio_key, next_options)\n
);\n
});\n
}\n
\n
function execSelectionNextCommand(gadget, previous_options) {\n
// Get the selection parameters\n
......@@ -516,6 +533,9 @@
if (command_options.path === COMMAND_HISTORY_PREVIOUS) {\n
return execHistoryPreviousCommand(gadget, previous_options);\n
}\n
if (command_options.path === COMMAND_PUSH_HISTORY) {\n
return execPushHistoryCommand(gadget, previous_options, next_options);\n
}\n
throw new Error(\'Unsupported command \' + command_options.path);\n
\n
}\n
......@@ -786,7 +806,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>946.35999.6366.29491</string> </value>
<value> <string>946.39127.64259.52206</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -804,7 +824,7 @@
</tuple>
<state>
<tuple>
<float>1445343438.7</float>
<float>1445531098.26</float>
<string>GMT</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