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
Tomáš Peterka
erp5
Commits
cd410667
Commit
cd410667
authored
Nov 03, 2017
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] Form field shows errors even when hidden (user-friendly)
parent
1588c73e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
16 deletions
+34
-16
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
+25
-12
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/PathTemplateItem/web_page_module/rjs_gadget_html5_element_js.js
...mplateItem/web_page_module/rjs_gadget_html5_element_js.js
+5
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_element_js.xml
...plateItem/web_page_module/rjs_gadget_html5_element_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
View file @
cd410667
...
...
@@ -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,16 +126,25 @@
}
if
(
modification_dict
.
hasOwnProperty
(
'
error_text
'
))
{
// 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
);
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
);
}
}
}
...
...
@@ -147,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
,
{
...
...
@@ -177,6 +189,7 @@
if
(
gadget
.
checkValidity
!==
undefined
)
{
return
gadget
.
checkValidity
();
}
window
.
console
.
log
(
'
Gadget
'
+
gadget
.
state
.
field_url
+
'
does NOT implement checkValidity!
'
);
return
true
;
});
})
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
View file @
cd410667
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
1.46539.43459.6519
</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>
150
3932157.58
</float>
<float>
150
7042725.04
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_element_js.js
View file @
cd410667
...
...
@@ -69,6 +69,11 @@
}
data
[
this
.
state
.
name
]
=
this
.
state
.
text_content
||
this
.
state
.
inner_html
||
""
;
return
data
;
})
/** Readonly fields are always valid */
.
declareMethod
(
"
checkValidity
"
,
function
()
{
return
true
;
});
}(
window
,
document
,
rJS
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_element_js.xml
View file @
cd410667
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
961.
46335.40182.23005
</string>
</value>
<value>
<string>
961.
57904.26336.47172
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
150
3909097.14
</float>
<float>
150
4605935.05
</float>
<string>
UTC
</string>
</tuple>
</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