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
Yoji Takeuchi
erp5
Commits
28934d42
Commit
28934d42
authored
Aug 29, 2017
by
Tomáš Peterka
Committed by
Tomáš Peterka
Sep 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] FloatField supports ERP5 percent numbers
parent
a14279e5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
17 deletions
+84
-17
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
+28
-7
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_erp5_nojqm_css.css
...emplateItem/web_page_module/rjs_gadget_erp5_nojqm_css.css
+14
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_nojqm_css.xml
...emplateItem/web_page_module/rjs_gadget_erp5_nojqm_css.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
+21
-4
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
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/erp5css.less.txt
...teItem/portal_skins/erp5_web_renderjs_ui/erp5css.less.txt
+15
-0
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.js
View file @
28934d42
/*global window, rJS */
/*global window, rJS
, Math
*/
/*jslint indent: 2, maxerr: 3 */
/*jslint indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
)
{
(
function
(
window
,
rJS
,
Math
)
{
"
use strict
"
;
"
use strict
"
;
rJS
(
window
)
rJS
(
window
)
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
field_json
=
options
.
field_json
||
{},
var
field_json
=
options
.
field_json
||
{},
value
=
field_json
.
value
||
field_json
.
default
||
""
,
value
=
field_json
.
value
||
field_json
.
default
||
""
,
percents
=
(
field_json
.
input_style
||
""
).
endsWith
(
"
%
"
),
state_dict
=
{
state_dict
=
{
editable
:
field_json
.
editable
,
editable
:
field_json
.
editable
,
required
:
field_json
.
required
,
required
:
field_json
.
required
,
...
@@ -21,14 +22,34 @@
...
@@ -21,14 +22,34 @@
precision
:
field_json
.
precision
,
precision
:
field_json
.
precision
,
hidden
:
field_json
.
hidden
hidden
:
field_json
.
hidden
};
};
// if value is 0.0 we assign empty instead - so we fix it here
if
(
field_json
.
value
!==
undefined
&&
field_json
.
value
!==
''
)
{
value
=
field_json
.
value
;
}
else
if
(
field_json
.
default
!==
undefined
&&
field_json
.
default
!==
''
)
{
value
=
field_json
.
default
;
}
value
=
window
.
parseFloat
(
value
);
// at this step we finished joggling with value
if
(
field_json
.
precision
)
{
if
(
field_json
.
precision
)
{
state_dict
.
step
=
1
/
Math
.
pow
(
10
,
field_json
.
precision
);
state_dict
.
step
=
Math
.
pow
(
10
,
-
field_json
.
precision
);
value
=
parseFloat
(
value
||
"
0
"
)
.
toFixed
(
field_json
.
precision
);
value
=
value
.
toFixed
(
field_json
.
precision
);
}
else
{
}
else
{
state_dict
.
step
=
0.00000001
;
// XXX did previous default step value make sense? 0.00000001
state_dict
.
step
=
1.0
;
}
if
(
percents
)
{
// ERP5 always devides the value by 10 if it is set to pe percentages
// thus we have to mitigate that in javascript here
value
*=
100.0
;
state_dict
.
append
=
"
%
"
;
}
}
state_dict
.
value
=
value
;
state_dict
.
value
=
value
;
state_dict
.
text_content
=
value
;
if
(
window
.
isNaN
(
value
))
{
state_dict
.
text_content
=
""
;
}
else
{
state_dict
.
text_content
=
value
.
toString
();
}
return
this
.
changeState
(
state_dict
);
return
this
.
changeState
(
state_dict
);
})
})
...
@@ -82,4 +103,4 @@
...
@@ -82,4 +103,4 @@
return
true
;
return
true
;
});
});
}(
window
,
rJS
));
}(
window
,
rJS
,
Math
));
\ No newline at end of file
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_floatfield_js.xml
View file @
28934d42
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
56.15742.1027.5070
5
</string>
</value>
<value>
<string>
9
61.41941.4473.5541
5
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1
482844714.9
</float>
<float>
1
503645555.71
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_nojqm_css.css
View file @
28934d42
...
@@ -1106,6 +1106,20 @@ div[data-gadget-scope='header'] .ui-header ul {
...
@@ -1106,6 +1106,20 @@ div[data-gadget-scope='header'] .ui-header ul {
}
}
}
}
/**********************************************
/**********************************************
* Gadget: HTML5 input field
**********************************************/
.gadget-content
.ui-field-contain
.ui-input-has-appendinx
,
.gadget-content
.ui-field-contain
.ui-input-has-prependinx
{
display
:
flex
;
}
.gadget-content
.ui-field-contain
.ui-input-has-appendinx
i
,
.gadget-content
.ui-field-contain
.ui-input-has-prependinx
i
{
display
:
block
;
padding
:
3pt
;
color
:
#777777
;
font-weight
:
400
;
}
/**********************************************
* Gadget: relation field
* Gadget: relation field
**********************************************/
**********************************************/
.relation-input
{
.relation-input
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_nojqm_css.xml
View file @
28934d42
...
@@ -242,7 +242,7 @@
...
@@ -242,7 +242,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
961.
19210.8471.60620
</string>
</value>
<value>
<string>
961.
42445.27813.34781
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -260,7 +260,7 @@
...
@@ -260,7 +260,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
150
2444264.19
</float>
<float>
150
3676812.98
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_element_js.js
View file @
28934d42
...
@@ -6,7 +6,13 @@
...
@@ -6,7 +6,13 @@
rJS
(
window
)
rJS
(
window
)
.
setState
({
.
setState
({
tag
:
'
div
'
,
tag
:
'
div
'
,
text_content
:
''
text_content
:
''
,
inner_html
:
''
,
name
:
undefined
,
src
:
undefined
,
alt
:
undefined
,
append
:
''
,
prepend
:
''
})
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
.
declareMethod
(
'
render
'
,
function
(
options
)
{
...
@@ -15,16 +21,27 @@
...
@@ -15,16 +21,27 @@
inner_html
:
options
.
inner_html
||
""
,
inner_html
:
options
.
inner_html
||
""
,
tag
:
options
.
tag
||
'
div
'
,
tag
:
options
.
tag
||
'
div
'
,
src
:
options
.
src
,
src
:
options
.
src
,
alt
:
options
.
alt
alt
:
options
.
alt
,
name
:
options
.
name
,
append
:
options
.
append
||
''
,
prepend
:
options
.
prepend
||
''
};
};
return
this
.
changeState
(
state_dict
);
return
this
.
changeState
(
state_dict
);
})
})
.
onStateChange
(
function
()
{
.
onStateChange
(
function
()
{
var
element
=
this
.
element
,
var
element
=
this
.
element
,
new_element
=
document
.
createElement
(
this
.
state
.
tag
);
new_element
=
document
.
createElement
(
this
.
state
.
tag
),
content
=
this
.
state
.
text_content
;
if
(
this
.
state
.
text_content
)
{
if
(
this
.
state
.
text_content
)
{
new_element
.
textContent
=
this
.
state
.
text_content
;
if
(
this
.
state
.
prepend
)
{
content
=
this
.
state
.
prepend
+
"
"
+
content
;
}
if
(
this
.
state
.
append
)
{
content
=
content
+
"
"
+
this
.
state
.
append
;
}
new_element
.
textContent
=
content
;
}
else
if
(
this
.
state
.
inner_html
)
{
}
else
if
(
this
.
state
.
inner_html
)
{
new_element
.
innerHTML
=
this
.
state
.
inner_html
;
new_element
.
innerHTML
=
this
.
state
.
inner_html
;
}
}
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_element_js.xml
View file @
28934d42
...
@@ -230,7 +230,7 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
55.51162.4768.35123
</string>
</value>
<value>
<string>
9
61.46335.40182.23005
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -248,7 +248,7 @@
...
@@ -248,7 +248,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1
482843300.9
</float>
<float>
1
503909097.14
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/erp5css.less.txt
View file @
28934d42
...
@@ -1285,6 +1285,21 @@ div[data-gadget-scope='header'] .ui-header {
...
@@ -1285,6 +1285,21 @@ div[data-gadget-scope='header'] .ui-header {
}
}
}
}
/**********************************************
* Gadget: HTML5 input field
**********************************************/
.gadget-content .ui-field-contain {
.ui-input-has-appendinx,
.ui-input-has-prependinx {
display: flex;
i {
display: block;
padding: 3pt;
color: #777777;
font-weight: 400;
}
}
}
/**********************************************
/**********************************************
* Gadget: relation field
* Gadget: relation field
**********************************************/
**********************************************/
...
...
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