Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
Eteri
erp5_fork
Commits
016684f2
Commit
016684f2
authored
Sep 20, 2017
by
Tomáš Peterka
Committed by
Tomáš Peterka
Sep 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] FloatField and Input uses render() to complete state change
parent
721fcfee
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
46 deletions
+20
-46
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.js
...lateItem/web_page_module/rjs_gadget_erp5_floatfield_js.js
+14
-26
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.xml
...ateItem/web_page_module/rjs_gadget_erp5_floatfield_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.js
...TemplateItem/web_page_module/rjs_gadget_html5_input_js.js
+2
-16
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.xml
...emplateItem/web_page_module/rjs_gadget_html5_input_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.js
View file @
016684f2
...
...
@@ -4,37 +4,30 @@
"
use strict
"
;
rJS
(
window
)
.
setState
({
type
:
"
number
"
,
// `step` is used for browser-level validation thus a mandatory value
// HTML5 default is 1.0 which is not feasible most of the time thus we
// default to over-sufficiently small value
step
:
0.00000001
,
required
:
false
,
editable
:
true
,
hidden
:
false
,
name
:
undefined
,
title
:
undefined
,
value
:
undefined
,
text_content
:
undefined
,
// `append` is a string to display next to the field (%, currency...)
append
:
undefined
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
field_json
=
options
.
field_json
||
{},
percentage
=
(
field_json
.
input_style
||
""
).
endsWith
(
"
%
"
),
state_dict
=
{
type
:
"
number
"
,
editable
:
field_json
.
editable
,
required
:
field_json
.
required
,
hidden
:
field_json
.
hidden
,
name
:
field_json
.
key
,
title
:
field_json
.
title
,
precision
:
window
.
parseFloat
(
field_json
.
precision
),
hidden
:
field_json
.
hidden
,
// erp5 always put value into "default"
value
:
window
.
parseFloat
(
field_json
.
default
)
// erp5 always put value into "default" (never "value")
value
:
window
.
parseFloat
(
field_json
.
default
),
text_content
:
''
,
// `step` is used for browser-level validation thus a mandatory value
// HTML5 default is 1.0 which is not feasible most of the time thus we
// default to over-sufficiently small value
step
:
0.00000001
,
// `append` is a string to display next to the field ("%", "EUR"...)
append
:
''
};
if
(
!
window
.
isNaN
(
state_dict
.
value
))
{
state_dict
.
text_content
=
state_dict
.
value
.
toString
();
}
if
(
!
window
.
isNaN
(
state_dict
.
precision
))
{
state_dict
.
step
=
Math
.
pow
(
10
,
-
state_dict
.
precision
);
state_dict
.
value
=
state_dict
.
value
.
toFixed
(
state_dict
.
precision
);
...
...
@@ -46,11 +39,6 @@
state_dict
.
append
=
"
%
"
;
}
if
(
window
.
isNaN
(
state_dict
.
value
))
{
state_dict
.
text_content
=
""
;
// show empty value insted of ugly "NaN"
}
else
{
state_dict
.
text_content
=
state_dict
.
value
.
toString
();
}
return
this
.
changeState
(
state_dict
);
})
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.xml
View file @
016684f2
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
962.1258
4.16558.54920
</string>
</value>
<value>
<string>
962.1258
8.2416.8721
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1505
816402.1
1
</float>
<float>
1505
921992.3
1
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.js
View file @
016684f2
...
...
@@ -15,20 +15,6 @@
}
rJS
(
window
)
.
setState
({
editable
:
false
,
value
:
undefined
,
checked
:
undefined
,
hidden
:
false
,
title
:
''
,
name
:
''
,
type
:
'
text
'
,
required
:
false
,
// mandatory field
trim
:
false
,
// trim content for spaces
focus
:
undefined
,
// has focus by default
prepend
:
undefined
,
// text to prepend infront the field
append
:
undefined
// text to apend after the field
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
return
this
.
changeState
({
...
...
@@ -44,8 +30,8 @@
step
:
options
.
step
,
hidden
:
options
.
hidden
,
trim
:
options
.
trim
||
false
,
append
:
options
.
append
,
prepend
:
options
.
prepend
append
:
options
.
append
,
// text to apend after the field
prepend
:
options
.
prepend
// text to prepend infront the field
});
})
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_input_js.xml
View file @
016684f2
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
962.138
86.9310.48640
</string>
</value>
<value>
<string>
962.138
97.43577.15308
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1505
894979.84
</float>
<float>
1505
922105.23
</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