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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
erp5
Commits
3becf829
Commit
3becf829
authored
Jan 15, 2018
by
Tomáš Peterka
Committed by
Tomáš Peterka
Jan 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] LinesField are valid when not editable
/reviewed-on
nexedi/erp5!551
parent
43a37bab
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
309 additions
and
2 deletions
+309
-2
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooView_setFieldsProperties.py
.../portal_skins/erp5_ui_test/FooView_setFieldsProperties.py
+119
-0
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooView_setFieldsProperties.xml
...portal_skins/erp5_ui_test/FooView_setFieldsProperties.xml
+66
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.js
...lateItem/web_page_module/rjs_gadget_erp5_linesfield_js.js
+3
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.xml
...ateItem/web_page_module/rjs_gadget_erp5_linesfield_js.xml
+2
-2
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_lines_field_zuite/testNonEditableDialogLinesField.xml
..._ui_lines_field_zuite/testNonEditableDialogLinesField.xml
+58
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_lines_field_zuite/testNonEditableDialogLinesField.zpt
..._ui_lines_field_zuite/testNonEditableDialogLinesField.zpt
+61
-0
No files found.
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooView_setFieldsProperties.py
0 → 100644
View file @
3becf829
"""(Re)Sets properties of chosen Fields in Foo_view.
Use this in your tests to alter for example Float Field configuration
instead of copy&pasting new form and changing such property manualy.
Usage: input parameters are supposed to have key <field-name>__<property_name> (please
note double underscore being separator). Those field/property combination will get
propagated into the view IF we already have default value for it.
Example: in your test, call ${base_url}/FooView_setFieldsProperties?my_quantity__precision=2&listbox_quantity__precision=checked
"""
portal
=
context
.
getPortalObject
()
form
=
portal
.
Foo_view
request
=
context
.
REQUEST
if
not
property_dict
:
# script called via URL receives its parameters in REQUEST.form
property_dict
.
update
(
request
.
form
)
field_default
=
{
'default'
:
''
,
'description'
:
''
,
'css_class'
:
''
,
'alternate_name'
:
''
,
'display_width'
:
'20'
,
'display_maxwidth'
:
''
,
'extra'
:
''
,
'external_validator'
:
''
,
'enabled'
:
'checked'
,
'editable'
:
'checked'
,
'required'
:
''
,
'hidden'
:
''
,
'whitespace_preserve'
:
''
,
}
default
=
{
# feel free to add more fields from the comment bellow or on your own
'my_lines_list'
:
dict
(
title
=
'Lines'
,
view_separator
=
'<br />'
,
width
=
'40'
,
height
=
'5'
,
unicode
=
''
,
max_linelength
=
''
,
max_lines
=
''
,
max_length
=
''
,
**
field_default
)
}
# For now - control fields only which are needed
# If anyone wishes to control more feel free to move
# the desired field from the comment bellow to the dict above
'''
'my_quantity': dict(
title='Quantity',
input_type='text',
input_style='-1 234.5',
precision='1',
**field_default
),
'listbox': dict(
title='Foo Lines',
lines=3,
columns="""id | ID
title | Title
quantity | Quantity
start_date | Date
catalog.uid | Uid""",
searchable_columns="""id | ID
title | Title
quantity | Quantity
start_date | Date""",
sort="id | id",
list_method="objectValues",
count_method="countFolder",
stat_method="portal_catalog",
selection_name="foo_selection",
portal_types="Foo Line | Foo Line",
search="checked",
select="checked",
editable_columns="""id | ID
title | Title
quantity | quantity
start_date | Date""",
stat_columns="quantity | Foo_statQuantity",
page_navigation_template="ListBox_viewSliderPageNavigationRenderer",
list_action="list",
**field_default
),
'listbox_quantity': dict(
title='Quantity',
input_type='text',
input_style='-1 234.5',
precision='',
**field_default
),
}
'''
# update defaults with user defined values
for
composed_key
,
value
in
property_dict
.
items
():
field_name
,
property_name
=
composed_key
.
split
(
'__'
)
# to allow overriding only default values
# throw an exception in case of non-existence of the field/property
assert
default
[
field_name
][
property_name
],
'Uknown field {} and property {}'
.
format
(
field_name
,
property_name
)
default
[
field_name
][
property_name
]
=
value
# update actual fields
for
field_name
in
default
:
field
=
form
.
get_field
(
field_name
)
field
.
manage_edit_xmlrpc
(
field
.
form
.
validate
(
{
'field_'
+
key
:
value
for
key
,
value
in
default
[
field_name
].
items
()}
)
)
return
'Set Successfully.'
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/FooView_setFieldsProperties.xml
0 → 100644
View file @
3becf829
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<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_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<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>
_params
</string>
</key>
<value>
<string>
**property_dict
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
FooView_setFieldsProperties
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Set Properties of Fields in Foo_view
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.js
View file @
3becf829
...
...
@@ -51,6 +51,9 @@
})
.
declareMethod
(
'
checkValidity
'
,
function
()
{
if
(
!
this
.
state
.
editable
)
{
return
true
;
}
return
this
.
getDeclaredGadget
(
'
sub
'
)
.
push
(
function
(
subgadget
)
{
return
subgadget
.
checkValidity
();
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.xml
View file @
3becf829
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
3.41690.30150.51729
</string>
</value>
<value>
<string>
96
4.54328.21867.14506
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
151
1408348.3
5
</float>
<float>
151
6015281.6
5
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_lines_field_zuite/testNonEditableDialogLinesField.xml
0 → 100644
View file @
3becf829
<?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>
testNonEditableDialogLinesField
</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>
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_lines_field_zuite/testNonEditableDialogLinesField.zpt
0 → 100644
View file @
3becf829
<html
xmlns:tal=
"http://xml.zope.org/namespaces/tal"
xmlns:metal=
"http://xml.zope.org/namespaces/metal"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>
Test non-editable lines field in editable form
</title>
</head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><td
rowspan=
"1"
colspan=
"3"
>
Test non-editable lines field in editable form
</td></tr>
</thead><tbody>
<tal:block
metal:use-macro=
"here/PTZuite_CommonTemplate/macros/init"
/>
<!-- Make lines field non-editable -->
<tr><td>
open
</td>
<td>
${base_url}/FooView_setFieldsProperties?my_lines_list__editable=
</td><td></td></tr>
<tr><td>
assertTextPresent
</td>
<td>
Set Successfully.
</td><td></td></tr>
<tr><td>
open
</td>
<td>
${base_url}/foo_module/Zuite_waitForActivities
</td><td></td></tr>
<tr><td>
assertTextPresent
</td>
<td>
Done.
</td><td></td></tr>
<!-- Shortcut for full renderjs url -->
<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=1
</td><td></td></tr>
<!-- Make sure lines render as non-editable -->
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope="field_my_lines_list"]
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope="field_my_lines_list"]//pre
</td><td></td></tr>
<tr><td>
verifyElementPresent
</td>
<td>
//div[@data-gadget-scope="field_my_lines_list"]//pre
</td><td></td></tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/save"
/>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope="field_my_lines_list"]
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//div[@data-gadget-scope="field_my_lines_list"]//pre
</td><td></td></tr>
<tr><td>
verifyElementPresent
</td>
<td>
//div[@data-gadget-scope="field_my_lines_list"]//pre
</td><td></td></tr>
<!-- Reset lines field back to defaults -->
<tr><td>
open
</td>
<td>
${base_url}/FooView_setFieldsProperties
</td><td></td></tr>
<tr><td>
assertTextPresent
</td>
<td>
Set Successfully.
</td><td></td></tr>
<tr><td>
open
</td>
<td>
${base_url}/foo_module/Zuite_waitForActivities
</td><td></td></tr>
<tr><td>
assertTextPresent
</td>
<td>
Done.
</td><td></td></tr>
</tbody>
</table>
</body>
</html>
\ No newline at end of file
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