Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastian
erp5
Commits
e5ce5ae6
Commit
e5ce5ae6
authored
May 06, 2015
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: add Base_callDialogMethod for custom dialog form action
parent
94df591f
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
317 additions
and
19 deletions
+317
-19
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.xml
...ortal_skins/erp5_hal_json_style/Base_callDialogMethod.xml
+302
-0
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
...tal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
+8
-1
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
...tem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
+7
-18
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.xml
0 → 100644
View file @
e5ce5ae6
This diff is collapsed.
Click to expand it.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.xml
View file @
e5ce5ae6
...
@@ -368,14 +368,21 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n
...
@@ -368,14 +368,21 @@ def renderField(field, form_relative_url, meta_type=None, key=None):\n
def renderForm(form, response_dict):\n
def renderForm(form, response_dict):\n
REQUEST.set(\'here\', traversed_document)\n
REQUEST.set(\'here\', traversed_document)\n
field_errors = REQUEST.get(\'field_errors\', {})\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
\n
# Form action\n
# Form action\n
response_dict[\'_actions\'] = {\n
response_dict[\'_actions\'] = {\n
\'put\': {\n
\'put\': {\n
"href": url_template_dict["form_action"] % {\n
"href": url_template_dict["form_action"] % {\n
"traversed_document_url": site_root.absolute_url() + "/" + traversed_document.getRelativeUrl(),\n
"traversed_document_url": site_root.absolute_url() + "/" + traversed_document.getRelativeUrl(),\n
"action_id":
form.action
\n
"action_id":
action_to_call
\n
},\n
},\n
"action": form.action,\n
"method": form.method,\n
"method": form.method,\n
}\n
}\n
}\n
}\n
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_form_dialog_js.xml
View file @
e5ce5ae6
...
@@ -158,7 +158,6 @@
...
@@ -158,7 +158,6 @@
form_gadget.props.editable = options.editable;\n
form_gadget.props.editable = options.editable;\n
form_gadget.props.action = erp5_document._embedded._view._actions.put;\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_id = erp5_document._embedded._view.form_id;\n
form_gadget.props.form_action = options.form_definition.action;\n
\n
\n
return form_gadget.getDeclaredGadget("erp5_form")\n
return form_gadget.getDeclaredGadget("erp5_form")\n
\n
\n
...
@@ -231,12 +230,7 @@
...
@@ -231,12 +230,7 @@
\n
\n
\n
\n
.declareService(function () {\n
.declareService(function () {\n
var form_gadget = this,\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
\n
\n
function formSubmit() {\n
function formSubmit() {\n
return form_gadget.notifySubmitting()\n
return form_gadget.notifySubmitting()\n
...
@@ -255,16 +249,11 @@
...
@@ -255,16 +249,11 @@
// XXX Hardcoded\n
// XXX Hardcoded\n
data.dialog_id =\n
data.dialog_id =\n
form_gadget.props.form_id[\'default\'];\n
form_gadget.props.form_id[\'default\'];\n
if (generic_dialog_id_list.indexOf(form_gadget.props.form_action) === -1) {\n
data.dialog_method = \n
is_custom_dialog = true;\n
form_gadget.props.action.action;\n
}\n
for (key in content_dict) {\n
for (key in content_dict) {\n
if (content_dict.hasOwnProperty(key)) {\n
if (content_dict.hasOwnProperty(key)) {\n
tmp = key;\n
data[key] = content_dict[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
}\n
}\n
}\n
}\n
\n
\n
...
@@ -277,7 +266,7 @@
...
@@ -277,7 +266,7 @@
})\n
})\n
.push(function (evt) {\n
.push(function (evt) {\n
var location = evt.target.getResponseHeader("X-Location");\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
// No redirection, stay on the same document\n
return form_gadget.whoWantToDisplayThisPage({name: "view"});\n
return form_gadget.whoWantToDisplayThisPage({name: "view"});\n
}\n
}\n
...
@@ -437,7 +426,7 @@
...
@@ -437,7 +426,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
942.
35946.42655.6161
</string>
</value>
<value>
<string>
942.
54421.21287.62378
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -455,7 +444,7 @@
...
@@ -455,7 +444,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1430
120185.39
</float>
<float>
1430
897308.57
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment