Commit 40848b9e authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[renderjs_ui] Dialog Form does not mingle with global "editable" state

parent af7f4b91
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
data-i18n=You do not have the permissions to edit the object data-i18n=You do not have the permissions to edit the object
data-i18n=Document was not saved! Resubmit when you are online or the document accessible data-i18n=Document was not saved! Resubmit when you are online or the document accessible
data-i18n=Encountered an unknown error. Try to resubmit data-i18n=Encountered an unknown error. Try to resubmit
data-i18n=Data received
--> -->
<head> <head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>960.5523.58984.43537</string> </value> <value> <string>960.56020.52206.40328</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1499432111.39</float> <float>1505912615.0</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -12,10 +12,6 @@ ...@@ -12,10 +12,6 @@
rJS(window) rJS(window)
.setState({
title: "",
editable: true // dialogs are always in editable mode
})
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// acquisition // acquisition
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
...@@ -59,7 +55,8 @@ ...@@ -59,7 +55,8 @@
// ignore options.editable because dialog is always editable // ignore options.editable because dialog is always editable
erp5_document: options.erp5_document, erp5_document: options.erp5_document,
form_definition: options.form_definition, form_definition: options.form_definition,
erp5_form: options.erp5_form || {} erp5_form: options.erp5_form || {},
// ignore global editable state (be always editable)
}); });
}) })
...@@ -123,7 +120,7 @@ ...@@ -123,7 +120,7 @@
form_options.form_definition = form_gadget.state.form_definition; form_options.form_definition = form_gadget.state.form_definition;
form_options.view = form_gadget.state.view; form_options.view = form_gadget.state.view;
form_options.jio_key = form_gadget.state.jio_key; form_options.jio_key = form_gadget.state.jio_key;
form_options.editable = form_gadget.state.editable; form_options.editable = true; // dialog is always editable
return erp5_form.render(form_options); return erp5_form.render(form_options);
}) })
...@@ -241,8 +238,8 @@ ...@@ -241,8 +238,8 @@
options: { options: {
"jio_key": jio_key, "jio_key": jio_key,
"view": "view", "view": "view",
"page": undefined, "page": undefined
"editable": form_gadget.state.editable // do not mingle with editable because it isn't necessary
} }
}); });
} }
...@@ -250,8 +247,8 @@ ...@@ -250,8 +247,8 @@
return form_gadget.redirect({ return form_gadget.redirect({
command: 'push_history', command: 'push_history',
options: { options: {
"jio_key": jio_key, "jio_key": jio_key
"editable": form_gadget.state.editable // do not mingle with editable because it isn't necessary
} }
}); });
}); });
...@@ -263,7 +260,7 @@ ...@@ -263,7 +260,7 @@
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return form_gadget.notifySubmitted({ return form_gadget.notifySubmitted({
"message": "Data received.", "message": "Data received",
"status": "success" "status": "success"
}); });
}) })
...@@ -280,7 +277,7 @@ ...@@ -280,7 +277,7 @@
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
return form_gadget.notifySubmitted({ return form_gadget.notifySubmitted({
"message": "Data received.", "message": "Data received",
"status": "success" "status": "success"
}); });
}) })
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>962.12762.25157.20224</string> </value> <value> <string>962.15378.64583.40345</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1505826868.64</float> <float>1505984600.8</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
rJS(window) rJS(window)
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Proxy methods to the child gadget // Proxy methods to the child gadget
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.16458.28534.25173</string> </value> <value> <string>961.56888.60131.33518</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1502116475.56</float> <float>1504617145.02</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -77,8 +77,9 @@ ...@@ -77,8 +77,9 @@
form_options.form_definition = gadget.state.form_definition; form_options.form_definition = gadget.state.form_definition;
form_options.view = gadget.state.view; form_options.view = gadget.state.view;
form_options.jio_key = gadget.state.jio_key; form_options.jio_key = gadget.state.jio_key;
form_options.editable = 0; form_options.editable = 0; // because for editable=1 there is a special
// page template 'pt_form_editable'. Once it is
// is removed, this 0 should turn into gadget.state.editable
return erp5_form.render(form_options); return erp5_form.render(form_options);
}) })
......
...@@ -230,7 +230,7 @@ ...@@ -230,7 +230,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>961.16419.13605.17578</string> </value> <value> <string>961.60785.60114.8243</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -248,7 +248,7 @@ ...@@ -248,7 +248,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1502116554.64</float> <float>1504874056.9</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
<!-- Workflow action always shows editable form dialog. <!-- Workflow action always shows editable form dialog.
- access a document in NONeditable mode - access a document in NONeditable mode
- any workflow action must be editable - any workflow action must(form dialog) be editable
- document must remain in previous (NONeditable) mode
--> -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Form View Editable Save Action</title> <title>Test Form View Editable Save Action</title>
...@@ -25,6 +26,16 @@ ...@@ -25,6 +26,16 @@
<td>${renderjs_url}/#/foo_module/1</td> <td>${renderjs_url}/#/foo_module/1</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view.html']</td>
<td></td>
</tr>
<tr>
<td>verifyElementNotPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view_editable.html']</td>
<td></td>
</tr>
<tr> <tr>
<td>waitForElementPresent</td> <td>waitForElementPresent</td>
<td>//a[text()='Actions']</td> <td>//a[text()='Actions']</td>
...@@ -67,6 +78,16 @@ ...@@ -67,6 +78,16 @@
<td>Status changed.</td> <td>Status changed.</td>
<td></td> <td></td>
</tr> </tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view.html']</td>
<td></td>
</tr>
<tr>
<td>verifyElementNotPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view_editable.html']</td>
<td></td>
</tr>
</tbody></table> </tbody></table>
</body> </body>
</html> </html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testFormViewEditablePersistent</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<!-- Editable form remains editable even after
- unsuccessful save
- sucessful save
- issued action
-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test Form View Editable Save Action</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Default Module View</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr><td>store</td>
<td>${base_url}/web_site_module/renderjs_runner</td>
<td>renderjs_url</td></tr>
<tr><td>open</td>
<td>${renderjs_url}/#/foo_module/1?editable=true</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view_editable.html']</td><td></td></tr>
<tr><td>verifyElementNotPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view.html']</td><td></td></tr>
<!-- Unsuccessful save does not mingle with editability -->
<tr><td>waitForElementPresent</td>
<td>//input[@name='field_my_foo_category_title']</td><td></td></tr>
<tr><td>type</td>
<td>//input[@name='field_my_foo_category_title']</td>
<td>QWERTY</td></tr>
<tr><td>fireEvent</td>
<td>//input[@name='field_my_foo_category_title']</td>
<td>input</td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='header']//button[text()='Save' and @type='submit']</td><td></td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-scope='header']//button[text()='Save' and @type='submit']</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr><td>waitForTextPresent</td>
<td>Input data has errors.</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view_editable.html']</td><td></td></tr>
<tr><td>verifyElementNotPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view.html']</td><td></td></tr>
<!-- Successful save does not mingle with editability -->
<tr><td>waitForElementPresent</td>
<td>//input[@name='field_my_foo_category_title']</td><td></td></tr>
<tr><td>type</td>
<td>//input[@name='field_my_foo_category_title']</td>
<td></td></tr>
<tr><td>fireEvent</td>
<td>//input[@name='field_my_foo_category_title']</td>
<td>input</td></tr>
<tr><td>waitForElementPresent</td>
<td>//input[@name='field_my_title']</td><td></td></tr>
<tr><td>type</td>
<td>field_my_title</td>
<td>QWERTY</td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='header']//button[text()='Save' and @type='submit']</td><td></td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-scope='header']//button[text()='Save' and @type='submit']</td><td></td></tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr><td>waitForTextPresent</td>
<td>Data updated.</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view_editable.html']</td><td></td></tr>
<tr><td>verifyElementNotPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view.html']</td><td></td></tr>
<!-- Passing through action does not mingle with editability -->
<tr><td>waitForElementPresent</td>
<td>//a[text()='Actions']</td><td></td></tr>
<tr><td>click</td>
<td>//a[text()='Actions']</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//a[@data-i18n='Dummy Workflow Action']</td><td></td></tr>
<tr><td>click</td>
<td>//a[@data-i18n='Dummy Workflow Action']</td><td></td></tr>
<!-- Wait for gadget to be loaded -->
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_dialog.html']//textarea</td><td></td></tr>
<!-- Textarea must be editable -->
<tr><td>type</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_dialog.html']//textarea</td>
<td>QWERTY</td></tr>
<tr><td>click</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_dialog.html']//input[@type='submit']</td><td></td></tr>
<tr><td>waitForTextPresent</td>
<td>Status changed.</td><td></td></tr>
<tr><td>waitForElementPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view_editable.html']</td><td></td></tr>
<tr><td>verifyElementNotPresent</td>
<td>//div[@data-gadget-url='${renderjs_url}/gadget_erp5_pt_form_view.html']</td><td></td></tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
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