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
Papa Tamsir Kane
erp5
Commits
39486f55
Commit
39486f55
authored
Aug 08, 2017
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] Add CSS classes (form field attribute) support to renderjs label and formbox
parent
5007a1d5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
49 additions
and
11 deletions
+49
-11
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+1
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_field_formbox_js.js
...eItem/web_page_module/rjs_gadget_erp5_field_formbox_js.js
+11
-5
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
-2
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_erp5_nojqm_css.css
...emplateItem/web_page_module/rjs_gadget_erp5_nojqm_css.css
+6
-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/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/erp5css.less.txt
...teItem/portal_skins/erp5_web_renderjs_ui/erp5css.less.txt
+7
-0
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
39486f55
...
@@ -463,6 +463,7 @@ def renderField(traversed_document, field, form_relative_url, value=None, meta_t
...
@@ -463,6 +463,7 @@ def renderField(traversed_document, field, form_relative_url, value=None, meta_t
'type'
:
meta_type
,
'type'
:
meta_type
,
'title'
:
Base_translateString
(
field
.
get_value
(
"title"
)),
'title'
:
Base_translateString
(
field
.
get_value
(
"title"
)),
'key'
:
key
,
'key'
:
key
,
"css_class"
:
field
.
get_value
(
"css_class"
),
"editable"
:
field
.
get_value
(
"editable"
),
"editable"
:
field
.
get_value
(
"editable"
),
'_embedded'
:
{
'_embedded'
:
{
'_view'
:
{
'_view'
:
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_field_formbox_js.js
View file @
39486f55
...
@@ -32,8 +32,9 @@
...
@@ -32,8 +32,9 @@
title
:
field_json
.
title
,
title
:
field_json
.
title
,
hidden
:
field_json
.
hidden
,
hidden
:
field_json
.
hidden
,
view
:
field_json
.
view
,
view
:
field_json
.
view
,
css_class
:
field_json
.
css_class
,
// field_json._embedded is HATEOASed subobj specs included in FormBox
// field_json._embedded is HATEOASed subobj specs included in FormBox
erp5_
form
:
field_json
.
_embedded
erp5_
embedded_document
:
field_json
.
_embedded
};
};
// prefer editability from the global context (form)
// prefer editability from the global context (form)
...
@@ -61,11 +62,11 @@
...
@@ -61,11 +62,11 @@
.
onStateChange
(
function
(
modification_dict
)
{
.
onStateChange
(
function
(
modification_dict
)
{
var
gadget
=
this
,
var
gadget
=
this
,
erp5_document_uri
=
new
URI
(
gadget
.
state
.
erp5_
form
.
_view
.
_links
.
traversed_document
.
href
),
erp5_document_uri
=
new
URI
(
gadget
.
state
.
erp5_
embedded_document
.
_view
.
_links
.
traversed_document
.
href
),
form_options
=
{
form_options
=
{
erp5_document
:
{
erp5_document
:
{
_embedded
:
gadget
.
state
.
erp5_
form
_embedded
:
gadget
.
state
.
erp5_
embedded_document
},
},
key
:
gadget
.
state
.
name
,
key
:
gadget
.
state
.
name
,
view
:
gadget
.
state
.
view
,
view
:
gadget
.
state
.
view
,
jio_key
:
erp5_document_uri
.
segment
(
2
),
jio_key
:
erp5_document_uri
.
segment
(
2
),
...
@@ -73,7 +74,12 @@
...
@@ -73,7 +74,12 @@
};
};
// do not preserve objects in the state
// do not preserve objects in the state
delete
gadget
.
state
.
erp5_form
;
delete
gadget
.
state
.
erp5_embedded_document
;
// pass CSS class to the DIV element
if
(
modification_dict
.
hasOwnProperty
(
'
css_class
'
))
{
gadget
.
element
.
classList
.
add
(
modification_dict
.
css_class
);
}
return
gadget
.
getDeclaredGadget
(
'
sub
'
)
return
gadget
.
getDeclaredGadget
(
'
sub
'
)
.
push
(
function
(
subgadget
)
{
.
push
(
function
(
subgadget
)
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
View file @
39486f55
/*global window, document, rJS, RSVP */
/*global window, document, rJS, RSVP */
/*jslint indent: 2, maxerr: 3 */
/*jslint indent: 2, maxerr: 3 */
/**
* Label gadget takes care of displaying validation errors and label.
*
* Every form field is wrapped in that widget which has some consequences:
*
* - CSS classes sharing: label copy CSS classes of embedded field for itself
* because CSS selectors are not good in selectin up the DOM tree
* - class "invisible" despite its name is supposed to hide only label
* - class "horizontal_align_form_box" will prevent any label to show as well
*
*/
(
function
(
window
,
document
,
rJS
,
RSVP
)
{
(
function
(
window
,
document
,
rJS
,
RSVP
)
{
"
use strict
"
;
"
use strict
"
;
...
@@ -9,8 +20,10 @@
...
@@ -9,8 +20,10 @@
.
setState
({
.
setState
({
label_text
:
''
,
label_text
:
''
,
error_text
:
''
,
error_text
:
''
,
label
:
true
label
:
true
,
css_class
:
''
})
})
.
ready
(
function
()
{
.
ready
(
function
()
{
return
this
.
changeState
({
return
this
.
changeState
({
label_element
:
this
.
element
.
querySelector
(
'
label
'
),
label_element
:
this
.
element
.
querySelector
(
'
label
'
),
...
@@ -28,7 +41,8 @@
...
@@ -28,7 +41,8 @@
error_text
:
options
.
field_json
.
error_text
||
''
,
error_text
:
options
.
field_json
.
error_text
||
''
,
options
:
options
,
options
:
options
,
scope
:
options
.
field_json
.
key
,
scope
:
options
.
field_json
.
key
,
hidden
:
options
.
field_json
.
hidden
hidden
:
options
.
field_json
.
hidden
,
css_class
:
options
.
field_json
.
css_class
};
};
return
this
.
changeState
(
state_dict
);
return
this
.
changeState
(
state_dict
);
})
})
...
@@ -48,6 +62,10 @@
...
@@ -48,6 +62,10 @@
}
}
this
.
state
.
label_element
.
setAttribute
(
'
for
'
,
gadget
.
state
.
scope
);
this
.
state
.
label_element
.
setAttribute
(
'
for
'
,
gadget
.
state
.
scope
);
if
(
modification_dict
.
hasOwnProperty
(
'
css_class
'
)
&&
this
.
state
.
css_class
)
{
this
.
state
.
label_element
.
classList
.
add
(
this
.
state
.
css_class
);
}
if
(
modification_dict
.
hasOwnProperty
(
'
error_text
'
))
{
if
(
modification_dict
.
hasOwnProperty
(
'
error_text
'
))
{
this
.
state
.
error_element
.
textContent
=
""
;
this
.
state
.
error_element
.
textContent
=
""
;
if
(
this
.
state
.
error_text
)
{
if
(
this
.
state
.
error_text
)
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.xml
View file @
39486f55
...
@@ -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.17308.23196.16947
</string>
</value>
<value>
<string>
9
61.17833.11141.14523
</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
482938684.96
</float>
<float>
1
502198959.61
</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 @
39486f55
...
@@ -974,6 +974,9 @@ div[data-gadget-scope='header'] .ui-header ul {
...
@@ -974,6 +974,9 @@ div[data-gadget-scope='header'] .ui-header ul {
.gadget-content
.ui-field-contain
div
{
.gadget-content
.ui-field-contain
div
{
width
:
100%
;
width
:
100%
;
}
}
.gadget-content
.horizontal_align_form_box
.ui-field-contain
>
div
{
display
:
block-inline
;
}
.gadget-content
.ui-content-header-plain
{
.gadget-content
.ui-content-header-plain
{
font-size
:
150%
;
font-size
:
150%
;
}
}
...
@@ -1048,6 +1051,9 @@ div[data-gadget-scope='header'] .ui-header ul {
...
@@ -1048,6 +1051,9 @@ div[data-gadget-scope='header'] .ui-header ul {
flex
:
1
;
flex
:
1
;
color
:
#777777
;
color
:
#777777
;
}
}
.gadget-content
.ui-field-contain
>
label
.invisible
{
display
:
none
;
}
.gadget-content
.ui-field-contain
>
label
+
div
{
.gadget-content
.ui-field-contain
>
label
+
div
{
flex
:
3
;
flex
:
3
;
}
}
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_nojqm_css.xml
View file @
39486f55
...
@@ -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.1
9028.47293.9045
</string>
</value>
<value>
<string>
961.1
7799.14348.6348
</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>
1502
271576.03
</float>
<float>
1502
199260.7
</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 @
39486f55
...
@@ -1117,6 +1117,10 @@ div[data-gadget-scope='header'] .ui-header {
...
@@ -1117,6 +1117,10 @@ div[data-gadget-scope='header'] .ui-header {
}
}
}
}
.horizontal_align_form_box .ui-field-contain > div {
display: block-inline;
}
.ui-content-header-plain {
.ui-content-header-plain {
font-size: 150%;
font-size: 150%;
}
}
...
@@ -1206,6 +1210,9 @@ div[data-gadget-scope='header'] .ui-header {
...
@@ -1206,6 +1210,9 @@ div[data-gadget-scope='header'] .ui-header {
& > label {
& > label {
flex: 1;
flex: 1;
color: @grey;
color: @grey;
&.invisible {
display: none;
}
}
}
& > label + div {
& > label + div {
flex: 3;
flex: 3;
...
...
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