Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_rtl_support
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
Romain Courteaud
erp5_rtl_support
Commits
e3d6285c
Commit
e3d6285c
authored
Dec 11, 2017
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] Show error on hidden fields
parent
62863ce9
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
912 additions
and
16 deletions
+912
-16
bt5/erp5_ui_test/ActionTemplateItem/portal_types/Foo/view_hidden_positive_only_quantity.xml
...m/portal_types/Foo/view_hidden_positive_only_quantity.xml
+83
-0
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewHiddenErrorneousField.xml
...rtal_skins/erp5_ui_test/Foo_viewHiddenErrorneousField.xml
+149
-0
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewHiddenErrorneousField/my_quantity.xml
...rp5_ui_test/Foo_viewHiddenErrorneousField/my_quantity.xml
+271
-0
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewHiddenErrorneousField/read_only_quantity.xml
...test/Foo_viewHiddenErrorneousField/read_only_quantity.xml
+277
-0
bt5/erp5_ui_test/bt/template_action_path_list
bt5/erp5_ui_test/bt/template_action_path_list
+1
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
...ateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
+20
-14
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
...teItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
+2
-2
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_notification_zuite/testHiddenFieldError.xml
...s/renderjs_ui_notification_zuite/testHiddenFieldError.xml
+58
-0
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_notification_zuite/testHiddenFieldError.zpt
...s/renderjs_ui_notification_zuite/testHiddenFieldError.zpt
+51
-0
No files found.
bt5/erp5_ui_test/ActionTemplateItem/portal_types/Foo/view_hidden_positive_only_quantity.xml
0 → 100644
View file @
e3d6285c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ActionInformation"
module=
"Products.CMFCore.ActionInformation"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<persistent>
<string
encoding=
"base64"
>
AAAAAAAAAAI=
</string>
</persistent>
</value>
</item>
<item>
<key>
<string>
categories
</string>
</key>
<value>
<tuple>
<string>
action_type/object_view
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
category
</string>
</key>
<value>
<string>
object_view
</string>
</value>
</item>
<item>
<key>
<string>
condition
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Form with hidden quantity field with external validator asserting positiveness of the value. Used to test behaviour of errors on hidden fields.
</string>
</value>
</item>
<item>
<key>
<string>
icon
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
view_hidden_positive_only_quantity
</string>
</value>
</item>
<item>
<key>
<string>
permissions
</string>
</key>
<value>
<tuple>
<string>
View
</string>
</tuple>
</value>
</item>
<item>
<key>
<string>
portal_type
</string>
</key>
<value>
<string>
Action Information
</string>
</value>
</item>
<item>
<key>
<string>
priority
</string>
</key>
<value>
<float>
10.0
</float>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
View Hidden Positive-Only Quantity
</string>
</value>
</item>
<item>
<key>
<string>
visible
</string>
</key>
<value>
<int>
1
</int>
</value>
</item>
</dictionary>
</pickle>
</record>
<record
id=
"2"
aka=
"AAAAAAAAAAI="
>
<pickle>
<global
name=
"Expression"
module=
"Products.CMFCore.Expression"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
text
</string>
</key>
<value>
<string>
string: ${object_url}/Foo_viewHiddenErrorneousField
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewHiddenErrorneousField.xml
0 → 100644
View file @
e3d6285c
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"ERP5 Form"
module=
"erp5.portal_type"
/>
</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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_objects
</string>
</key>
<value>
<tuple/>
</value>
</item>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
Base_edit
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
<value>
<string>
Display some integers field for selenium tests
</string>
</value>
</item>
<item>
<key>
<string>
edit_order
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
enctype
</string>
</key>
<value>
<string></string>
</value>
</item>
<item>
<key>
<string>
group_list
</string>
</key>
<value>
<list>
<string>
left
</string>
<string>
right
</string>
<string>
center
</string>
<string>
bottom
</string>
<string>
hidden
</string>
</list>
</value>
</item>
<item>
<key>
<string>
groups
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
bottom
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
center
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
hidden
</string>
</key>
<value>
<list/>
</value>
</item>
<item>
<key>
<string>
left
</string>
</key>
<value>
<list>
<string>
my_quantity
</string>
<string>
read_only_quantity
</string>
</list>
</value>
</item>
<item>
<key>
<string>
right
</string>
</key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
Foo_viewHiddenErrorneousField
</string>
</value>
</item>
<item>
<key>
<string>
method
</string>
</key>
<value>
<string>
POST
</string>
</value>
</item>
<item>
<key>
<string>
name
</string>
</key>
<value>
<string>
Foo_view
</string>
</value>
</item>
<item>
<key>
<string>
pt
</string>
</key>
<value>
<string>
form_view
</string>
</value>
</item>
<item>
<key>
<string>
row_length
</string>
</key>
<value>
<int>
4
</int>
</value>
</item>
<item>
<key>
<string>
stored_encoding
</string>
</key>
<value>
<string>
UTF-8
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
Foo
</string>
</value>
</item>
<item>
<key>
<string>
unicode_mode
</string>
</key>
<value>
<int>
0
</int>
</value>
</item>
<item>
<key>
<string>
update_action
</string>
</key>
<value>
<string></string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewHiddenErrorneousField/my_quantity.xml
0 → 100644
View file @
e3d6285c
This diff is collapsed.
Click to expand it.
bt5/erp5_ui_test/SkinTemplateItem/portal_skins/erp5_ui_test/Foo_viewHiddenErrorneousField/read_only_quantity.xml
0 → 100644
View file @
e3d6285c
This diff is collapsed.
Click to expand it.
bt5/erp5_ui_test/bt/template_action_path_list
View file @
e3d6285c
...
...
@@ -30,6 +30,7 @@ Foo | view_duration_field
Foo | view_formbox
Foo | view_formbox_dialog
Foo | view_formbox_fooline
Foo | view_hidden_positive_only_quantity
Foo | view_listbox
Foo | view_multiple_listbox
Foo | view_planning
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
View file @
e3d6285c
...
...
@@ -84,6 +84,8 @@
});
})
.
declareAcquiredMethod
(
"
notifyChange
"
,
"
notifyChange
"
)
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
state_dict
=
{
label_text
:
options
.
field_json
.
title
||
''
,
...
...
@@ -105,7 +107,8 @@
.
onStateChange
(
function
(
modification_dict
)
{
var
gadget
=
this
,
span
;
span
,
promise_queue
=
new
RSVP
.
Queue
();
if
(
gadget
.
state
.
hidden
)
{
this
.
element
.
hidden
=
true
;
...
...
@@ -123,22 +126,25 @@
}
if
(
modification_dict
.
hasOwnProperty
(
'
error_text
'
))
{
// first remove old errors
span
=
this
.
state
.
container_element
.
lastElementChild
;
if
((
span
!==
null
)
&&
(
span
.
tagName
.
toLowerCase
()
!==
'
span
'
))
{
span
=
null
;
}
// display new error if present
if
(
this
.
state
.
error_text
)
{
if
(
span
===
null
)
{
if
(
this
.
state
.
hidden
)
{
promise_queue
.
push
(
function
()
{
return
gadget
.
notifyChange
({
"
message
"
:
gadget
.
state
.
error_text
,
"
status
"
:
"
error
"
});
});
}
else
{
// first remove old errors
span
=
this
.
state
.
container_element
.
querySelector
(
'
span
'
);
if
(
span
)
{
this
.
state
.
container_element
.
removeChild
(
span
);
}
// display new error if present
if
(
this
.
state
.
error_text
)
{
span
=
document
.
createElement
(
'
span
'
);
span
.
textContent
=
this
.
state
.
error_text
;
this
.
state
.
container_element
.
appendChild
(
span
);
}
else
{
span
.
textContent
=
this
.
state
.
error_text
;
}
}
else
if
(
span
!==
null
)
{
this
.
state
.
container_element
.
removeChild
(
span
);
}
}
...
...
@@ -153,7 +159,7 @@
if
(
modification_dict
.
hasOwnProperty
(
'
options
'
))
{
if
(
this
.
state
.
field_url
)
{
return
new
RSVP
.
Queue
()
return
promise_queue
.
push
(
function
()
{
if
(
modification_dict
.
hasOwnProperty
(
'
field_url
'
))
{
return
gadget
.
declareGadget
(
gadget
.
state
.
field_url
,
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
View file @
e3d6285c
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
4.7149.35202.27306
</string>
</value>
<value>
<string>
96
2.34466.32248.6604
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
15
13181723.22
</float>
<float>
15
07042725.04
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_notification_zuite/testHiddenFieldError.xml
0 → 100644
View file @
e3d6285c
<?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>
testHiddenFieldError
</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_notification_zuite/testHiddenFieldError.zpt
0 → 100644
View file @
e3d6285c
<html>
<head><title>
Test Invoices Report Skin Allowance
</title></head>
<body>
<table
cellpadding=
"1"
cellspacing=
"1"
border=
"1"
>
<thead>
<tr><th
rowspan=
"1"
colspan=
"4"
>
Check that user gets notified if there is an error on a hidden field.
</th></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=1
</td><td></td></tr>
<!-- Originaly the field was required and we tested here an empty value. Problem is that Firefox
evaluates numerical rule before required value wheras Chrome does it in the opposite direction -->
<!-- Put negative quantity so the external validator will not pass external test in the next view -->
<tr><td>
waitForElementPresent
</td>
<td>
//input[@name="field_my_quantity"]
</td><td></td></tr>
<tr><td>
type
</td>
<td>
//input[@name="field_my_quantity"]
</td>
<td>
-20
</td></tr>
<tal:block
metal:use-macro=
"here/Zuite_CommonTemplateForRenderjsUi/macros/save"
/>
<!-- Let the external validator throw an error - this time we test explicitely
for a notification with the error -->
<tr><td>
waitForElementPresent
</td>
<td>
//a[@data-i18n="Views"]
</td><td></td></tr>
<tr><td>
click
</td>
<td>
//a[@data-i18n="Views"]
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//a[@data-i18n="View Hidden Positive-Only Quantity"]
</td><td></td></tr>
<tr><td>
click
</td>
<td>
//a[@data-i18n="View Hidden Positive-Only Quantity"]
</td><td></td></tr>
<tr><td>
waitForElementPresent
</td>
<td>
//button[@data-i18n='Save']
</td><td></td></tr>
<tr><td>
click
</td>
<td>
//button[@data-i18n='Save']
</td><td></td></tr>
<tr><td>
waitForTextPresent
</td>
<td>
The input failed the external validator.
</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