Commit e5ce5ae6 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: add Base_callDialogMethod for custom dialog form action

parent 94df591f
......@@ -368,14 +368,21 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n
def renderForm(form, response_dict):\n
REQUEST.set(\'here\', traversed_document)\n
field_errors = REQUEST.get(\'field_errors\', {})\n
\n
#hardcoded\n
if form.pt == \'form_dialog\':\n
action_to_call = "Base_callDialogMethod"\n
else:\n
action_to_call = form.action\n
\n
# Form action\n
response_dict[\'_actions\'] = {\n
\'put\': {\n
"href": url_template_dict["form_action"] % {\n
"traversed_document_url": site_root.absolute_url() + "/" + traversed_document.getRelativeUrl(),\n
"action_id": form.action\n
"action_id": action_to_call\n
},\n
"action": form.action,\n
"method": form.method,\n
}\n
}\n
......
......@@ -158,7 +158,6 @@
form_gadget.props.editable = options.editable;\n
form_gadget.props.action = erp5_document._embedded._view._actions.put;\n
form_gadget.props.form_id = erp5_document._embedded._view.form_id;\n
form_gadget.props.form_action = options.form_definition.action;\n
\n
return form_gadget.getDeclaredGadget("erp5_form")\n
\n
......@@ -231,12 +230,7 @@
\n
\n
.declareService(function () {\n
var form_gadget = this,\n
is_custom_dialog = false,\n
tmp,\n
generic_dialog_id_list = ["Base_configureUI", "Base_configureSortOn", "Workflow_statusModify",\n
"Base_editRelation", "Base_createRelation", "Folder_delete",\n
"Base_newContentFromJS"];\n
var form_gadget = this;\n
\n
function formSubmit() {\n
return form_gadget.notifySubmitting()\n
......@@ -255,16 +249,11 @@
// XXX Hardcoded\n
data.dialog_id =\n
form_gadget.props.form_id[\'default\'];\n
if (generic_dialog_id_list.indexOf(form_gadget.props.form_action) === -1) {\n
is_custom_dialog = true;\n
}\n
data.dialog_method = \n
form_gadget.props.action.action;\n
for (key in content_dict) {\n
if (content_dict.hasOwnProperty(key)) {\n
tmp = key;\n
if (is_custom_dialog && (key.indexOf("field_your") === 0 || key.indexOf("field_my") === 0)) {\n
tmp = key.split("_")[2];\n
}\n
data[tmp] = content_dict[key];\n
data[key] = content_dict[key];\n
}\n
}\n
\n
......@@ -277,7 +266,7 @@
})\n
.push(function (evt) {\n
var location = evt.target.getResponseHeader("X-Location");\n
if (location === undefined) {\n
if (location === undefined || location === null) {\n
// No redirection, stay on the same document\n
return form_gadget.whoWantToDisplayThisPage({name: "view"});\n
}\n
......@@ -437,7 +426,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>942.35946.42655.6161</string> </value>
<value> <string>942.54421.21287.62378</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -455,7 +444,7 @@
</tuple>
<state>
<tuple>
<float>1430120185.39</float>
<float>1430897308.57</float>
<string>UTC</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