Commit 81eca52d authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_web_renderjs_ui: listbox in list_mode and form_view should be displayed as non editable

parent 1c81ac54
......@@ -103,7 +103,7 @@
/*global window, rJS, RSVP, document, loopEventListener */\n
/*jslint indent: 2 */\n
(function (window, rJS, RSVP) {\n
(function (window, rJS, RSVP, document, loopEventListener) {\n
"use strict";\n
rJS(window)\n
.ready(function (gadget) {\n
......@@ -115,6 +115,9 @@
})\n
.declareAcquiredMethod("notifyInvalid", "notifyInvalid")\n
.declareAcquiredMethod("notifyValid", "notifyValid")\n
.declareMethod(\'getTextContent\', function () {\n
return this.element.querySelector(\'input\').getAttribute(\'value\') || "";\n
})\n
.declareMethod(\'render\', function (options) {\n
var input = this.element.querySelector(\'input\'),\n
date,\n
......@@ -379,7 +382,7 @@
);\n
});\n
\n
}(window, rJS, RSVP));
}(window, rJS, RSVP, document, loopEventListener));
]]></string> </value>
</item>
......@@ -516,7 +519,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>943.49747.10334.23005</string> </value>
<value> <string>949.15487.9675.47530</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -534,7 +537,7 @@
</tuple>
<state>
<tuple>
<float>1434544511.89</float>
<float>1455899218.47</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -114,6 +114,9 @@
.declareAcquiredMethod("notifyValid", "notifyValid")\n
.declareAcquiredMethod("notifyInvalid", "notifyInvalid")\n
.declareAcquiredMethod("notifyChange", "notifyChange")\n
.declareMethod(\'getTextContent\', function () {\n
return this.element.querySelector(\'input\').getAttribute(\'value\');\n
})\n
.declareMethod(\'render\', function (options) {\n
var input = this.element.querySelector(\'input\'),\n
step = 0.00000001,\n
......@@ -319,7 +322,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -333,7 +336,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.63306.33653.13909</string> </value>
<value> <string>949.15478.31551.48810</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -351,7 +354,7 @@
</tuple>
<state>
<tuple>
<float>1423907635.25</float>
<float>1455899205.51</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -114,6 +114,9 @@
.declareAcquiredMethod("notifyValid", "notifyValid")\n
.declareAcquiredMethod("notifyInvalid", "notifyInvalid")\n
.declareAcquiredMethod("notifyChange", "notifyChange")\n
.declareMethod(\'getTextContent\', function () {\n
return this.element.querySelector(\'input\').getAttribute(\'value\');\n
})\n
.declareMethod(\'render\', function (options) {\n
var input = this.element.querySelector(\'input\'),\n
field_json = options.field_json || {};\n
......@@ -313,7 +316,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>xiaowu</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -327,7 +330,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.60759.64011.7748</string> </value>
<value> <string>949.15479.42024.21538</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -345,7 +348,7 @@
</tuple>
<state>
<tuple>
<float>1423754481.36</float>
<float>1455899193.71</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -173,17 +173,45 @@
gadget.props.listbox_uid_dict = {};\n
gadget.props.cell_gadget_list = [];\n
function renderSubCell(element, sub_field_json) {\n
return gadget.getFieldTypeGadgetUrl(sub_field_json.type)\n
var options = {},\n
queue;\n
sub_field_json.editable = sub_field_json.editable && gadget.props.field_json.editable; // XXX \n
queue = gadget.getFieldTypeGadgetUrl(sub_field_json.type);\n
queue\n
.push(function (gadget_url) {\n
return gadget.declareGadget(gadget_url, {\n
if (sub_field_json.editable) {\n
options = {\n
element: element\n
});\n
};\n
}\n
return gadget.declareGadget(gadget_url, options);\n
})\n
.push(function (cell_gadget) {\n
if (sub_field_json.editable) {\n
gadget.props.cell_gadget_list.push(cell_gadget);\n
sub_field_json.editable = sub_field_json.editable && gadget.props.field_json.editable; // XXX \n
} else {\n
if (cell_gadget.getTextContent) {\n
queue\n
.push(function () {\n
return cell_gadget.getTextContent();\n
})\n
.push(function (text_content) {\n
var text = document.createTextNode(text_content);\n
element.appendChild(text);\n
});\n
} else {\n
queue\n
.push(function () {\n
return cell_gadget.getElement();\n
})\n
.push(function (cell_element) {\n
element.appendChild(cell_element);\n
});\n
}\n
}\n
return cell_gadget.render({field_json: sub_field_json});\n
});\n
return queue;\n
}\n
for (i = 0; i < element_list.length; i += 1) {\n
column = element_list[i].getAttribute("column");\n
......@@ -498,7 +526,7 @@
value = result.data.rows[i].value[field_json.column_list[j][0]] || "";\n
tr_value.push({\n
"type": value.type,\n
"editable": value.editable,\n
"editable": value.editable && field_json.editable,\n
"href": tmp_url,\n
"text": value,\n
"line": i,\n
......@@ -843,7 +871,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>949.16491.61409.54647</string> </value>
<value> <string>949.16516.37897.4249</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -861,7 +889,7 @@
</tuple>
<state>
<tuple>
<float>1455884364.32</float>
<float>1455899151.12</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -134,6 +134,10 @@
.declareAcquiredMethod("translateHtml", "translateHtml")\n
.declareAcquiredMethod("notifyValid", "notifyValid")\n
.declareAcquiredMethod("notifyInvalid", "notifyInvalid")\n
.declareMethod(\'getTextContent\', function () {\n
var select = this.element.querySelector(\'select\');\n
return select.options[select.selectedIndex || 0].text;\n
})\n
.declareMethod(\'render\', function (options) {\n
var i,\n
template,\n
......@@ -357,7 +361,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>940.49457.43407.46148</string> </value>
<value> <string>949.15483.53582.15957</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -375,7 +379,7 @@
</tuple>
<state>
<tuple>
<float>1423135404.46</float>
<float>1455899167.96</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -115,7 +115,9 @@
.declareAcquiredMethod("notifyValid", "notifyValid")\n
.declareAcquiredMethod("notifyInvalid", "notifyInvalid")\n
.declareAcquiredMethod("notifyChange", "notifyChange")\n
\n
.declareMethod(\'getTextContent\', function () {\n
return this.element.querySelector(\'input\').getAttribute(\'value\');\n
})\n
.declareMethod(\'render\', function (options) {\n
var input = this.element.querySelector(\'input\'),\n
field_json = options.field_json || {};\n
......@@ -317,7 +319,7 @@
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>romain</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -331,7 +333,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>937.64311.60842.27084</string> </value>
<value> <string>949.15479.27859.47018</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -349,8 +351,8 @@
</tuple>
<state>
<tuple>
<float>1412257626.39</float>
<string>GMT</string>
<float>1455899182.71</float>
<string>UTC</string>
</tuple>
</state>
</object>
......
......@@ -180,15 +180,15 @@
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//input[@title="listbox_start_date"]</td>\n
<td>waitForTextPresent</td>\n
<td>2022-12-21</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>verifyValue</td>\n
<td>//input[@title="listbox_start_date"]</td>\n
<td>waitForTextPresent</td>\n
<td>2022-12-21</td>\n
<td></td>\n
</tr>\n
\n
</tbody></table>\n
......
<?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>_text</string> </key>
<value> <unicode encoding="cdata"><![CDATA[
<html xmlns:tal="http://xml.zope.org/namespaces/tal"\n
xmlns:metal="http://xml.zope.org/namespaces/metal">\n
<head>\n
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n
<title>Test RenderJS UI</title>\n
</head>\n
<body>\n
<table cellpadding="1" cellspacing="1" border="1">\n
<thead>\n
<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr>\n
</thead><tbody>\n
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />\n
\n
<!-- Clean Up -->\n
<tr>\n
<td>open</td>\n
<td>${base_url}/bar_module/ListBoxZuite_reset</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>assertTextPresent</td>\n
<td>Reset Successfully.</td>\n
<td></td>\n
</tr>\n
\n
<!-- Initialize -->\n
<tr>\n
<td>open</td>\n
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//a[@data-i18n=\'Add\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>click</td>\n
<td>link=Add</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>select</td>\n
<td>//select[@name=\'field_your_portal_type\']</td>\n
<td>label=Foo</td>\n
</tr>\n
\n
<tr>\n
<td>click</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//a[@data-i18n="Add"]</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>click</td>\n
<td>//a[@data-i18n="Add"]</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>click</td>\n
<td>link=Add</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>select</td>\n
<td>//select[@name=\'field_your_portal_type\']</td>\n
<td>label=Foo Line</td>\n
</tr>\n
\n
<tr>\n
<td>click</td>\n
<td>//button[@data-i18n=\'Proceed\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//button[@data-i18n=\'Save\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>click</td>\n
<td>//a[@data-i18n=\'Back\']</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//input[@title="listbox_start_date"]</td>\n
<td></td>\n
</tr>\n
\n
\n
<tr>\n
<td>click</td>\n
<td>//a[@data-i18n="Tabs"]</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForElementPresent</td>\n
<td>//a[@data-i18n="View"]</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>click</td>\n
<td>//a[@data-i18n="View"]</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>waitForTextPresent</td>\n
<td>1</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>verifyTextPresent</td>\n
<td>1</td>\n
<td></td>\n
</tr>\n
\n
<tr>\n
<td>verifyElementNotPresent</td>\n
<td>//input[@title="listbox_start_date"]</td>\n
<td></td>\n
</tr>\n
\n
\n
\n
</tbody></table>\n
</body>\n
</html>
]]></unicode> </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>testListboxInNoEditableMode</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>
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