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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gabriel Monnerat
erp5
Commits
e3921c42
Commit
e3921c42
authored
Oct 14, 2020
by
Gabriel Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hal_json_style: calculate link to allow Nexedi developer access the ERP5 field from it.
parent
751d975a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
5 deletions
+73
-5
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+34
-3
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
+32
-1
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
+3
-0
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
+4
-1
No files found.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
e3921c42
...
@@ -337,8 +337,13 @@ url_template_dict = {
...
@@ -337,8 +337,13 @@ url_template_dict = {
}
}
default_document_uri_template
=
url_template_dict
[
"jio_get_template"
]
default_document_uri_template
=
url_template_dict
[
"jio_get_template"
]
Base_translateString
=
context
.
getPortalObject
().
Base_translateString
portal
=
context
.
getPortalObject
()
portal_absolute_url
=
portal
.
absolute_url
()
preference_tool
=
portal
.
portal_preferences
Base_translateString
=
portal
.
Base_translateString
preferred_html_style_developper_mode
=
preference_tool
.
getPreferredHtmlStyleDevelopperMode
()
preferred_html_style_translator_mode
=
preference_tool
.
getPreferredHtmlStyleTranslatorMode
()
def
getRealRelativeUrl
(
document
):
def
getRealRelativeUrl
(
document
):
return
'/'
.
join
(
portal
.
portal_url
.
getRelativeContentPath
(
document
))
return
'/'
.
join
(
portal
.
portal_url
.
getRelativeContentPath
(
document
))
...
@@ -446,6 +451,32 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k
...
@@ -446,6 +451,32 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k
"description"
:
field
.
get_value
(
"description"
),
"description"
:
field
.
get_value
(
"description"
),
}
}
if
preferred_html_style_developper_mode
or
meta_type
==
"ListBox"
:
form_relative_url
=
getFormRelativeUrl
(
form
)
if
preferred_html_style_developper_mode
:
result
[
"edit_field_href"
]
=
'%s/%s/manage_main'
%
(
form_relative_url
,
field
.
id
)
result
[
"edit_field_icon"
]
=
"%s/images/editfield.png"
%
portal_absolute_url
if
preferred_html_style_translator_mode
:
erp5_ui
=
portal
.
Localizer
.
erp5_ui
selected_language
=
erp5_ui
.
get_selected_language
()
result
[
"translate_title_href"
]
=
'%s/manage_messages?regex=^%s&lang=%s'
%
(
'/'
.
join
(
erp5_ui
.
getPhysicalPath
()),
field
.
title
(),
selected_language
)
result
[
"translate_title_icon"
]
=
"%s/images/translate.png"
%
portal_absolute_url
field_description
=
field
.
Field_getDescription
()
if
field_description
:
result
[
"translate_description_href"
]
=
'%s/manage_messages?regex=^%s&lang=%s'
%
(
'/'
.
join
(
erp5_ui
.
getPhysicalPath
()),
field_description
,
selected_language
)
result
[
"translate_description_icon"
]
=
"%s/images/translate_tooltip.png"
%
portal_absolute_url
if
"Field"
in
meta_type
:
if
"Field"
in
meta_type
:
# fields have default value and can be required (unlike boxes)
# fields have default value and can be required (unlike boxes)
result
[
"required"
]
=
field
.
get_value
(
"required"
)
if
field
.
has_value
(
"required"
)
else
None
result
[
"required"
]
=
field
.
get_value
(
"required"
)
if
field
.
has_value
(
"required"
)
else
None
...
@@ -737,7 +768,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k
...
@@ -737,7 +768,7 @@ def renderField(traversed_document, field, form, value=MARKER, meta_type=None, k
"root_url"
:
site_root
.
absolute_url
(),
"root_url"
:
site_root
.
absolute_url
(),
"script_id"
:
script
.
id
,
"script_id"
:
script
.
id
,
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"relative_url"
:
getRealRelativeUrl
(
traversed_document
).
replace
(
"/"
,
"%2F"
),
"form_relative_url"
:
"%s/%s"
%
(
getFormRelativeUrl
(
form
)
,
field
.
id
),
"form_relative_url"
:
"%s/%s"
%
(
form_relative_url
,
field
.
id
),
"list_method"
:
list_method_name
,
"list_method"
:
list_method_name
,
"default_param_json"
:
urlsafe_b64encode
(
"default_param_json"
:
urlsafe_b64encode
(
json
.
dumps
(
ensureSerializable
(
list_method_query_dict
))),
json
.
dumps
(
ensureSerializable
(
list_method_query_dict
))),
...
@@ -1291,7 +1322,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
...
@@ -1291,7 +1322,7 @@ def calculateHateoas(is_portal=None, is_site_root=None, traversed_document=None,
# Always inform about portal
# Always inform about portal
"portal"
:
{
"portal"
:
{
"href"
:
default_document_uri_template
%
{
"href"
:
default_document_uri_template
%
{
"root_url"
:
portal
.
absolute_url
()
,
"root_url"
:
portal
_absolute_url
,
# XXX the portal has an empty getRelativeUrl. Make it still compatible
# XXX the portal has an empty getRelativeUrl. Make it still compatible
# with restrictedTraverse
# with restrictedTraverse
"relative_url"
:
portal
.
getId
(),
"relative_url"
:
portal
.
getId
(),
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_label_field_js.js
View file @
e3921c42
...
@@ -111,7 +111,8 @@
...
@@ -111,7 +111,8 @@
css_class
,
css_class
,
i
,
i
,
queue
,
queue
,
new_div
;
new_div
,
field_href
;
if
(
modification_dict
.
hasOwnProperty
(
'
first_call
'
))
{
if
(
modification_dict
.
hasOwnProperty
(
'
first_call
'
))
{
gadget
.
props
=
{
gadget
.
props
=
{
...
@@ -131,6 +132,36 @@
...
@@ -131,6 +132,36 @@
}
}
this
.
props
.
label_element
.
setAttribute
(
'
for
'
,
gadget
.
state
.
scope
);
this
.
props
.
label_element
.
setAttribute
(
'
for
'
,
gadget
.
state
.
scope
);
if
(
field_json
)
{
if
(
field_json
.
hasOwnProperty
(
'
edit_field_href
'
))
{
field_href
=
document
.
createElement
(
"
a
"
);
field_href
.
href
=
field_json
.
edit_field_href
;
field_href
.
title
=
"
Edit this field
"
;
field_href
.
appendChild
(
document
.
createElement
(
"
img
"
));
field_href
.
firstElementChild
.
src
=
field_json
.
edit_field_icon
;
this
.
props
.
label_element
.
appendChild
(
field_href
);
}
if
(
field_json
.
hasOwnProperty
(
'
translate_title_href
'
))
{
field_href
=
document
.
createElement
(
"
a
"
);
field_href
.
href
=
field_json
.
translate_title_href
;
field_href
.
title
=
"
Translate this field title
"
;
field_href
.
appendChild
(
document
.
createElement
(
"
img
"
));
field_href
.
firstElementChild
.
src
=
field_json
.
translate_title_icon
;
this
.
props
.
label_element
.
appendChild
(
field_href
);
}
if
(
field_json
.
hasOwnProperty
(
'
translate_description_href
'
))
{
field_href
=
document
.
createElement
(
"
a
"
);
field_href
.
href
=
field_json
.
translate_description_href
;
field_href
.
title
=
"
Translate this field description
"
;
field_href
.
appendChild
(
document
.
createElement
(
"
img
"
));
field_href
.
firstElementChild
.
src
=
field_json
.
translate_description_icon
;
this
.
props
.
label_element
.
appendChild
(
field_href
);
}
}
if
(
modification_dict
.
hasOwnProperty
(
'
css_class
'
)
&&
this
.
state
.
css_class
)
{
if
(
modification_dict
.
hasOwnProperty
(
'
css_class
'
)
&&
this
.
state
.
css_class
)
{
css_class
=
this
.
state
.
css_class
.
split
(
'
'
);
css_class
=
this
.
state
.
css_class
.
split
(
'
'
);
for
(
i
=
0
;
i
<
css_class
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
css_class
.
length
;
i
+=
1
)
{
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_nojqm_css.css
View file @
e3921c42
...
@@ -1180,6 +1180,9 @@ div[data-gadget-scope='header'] .ui-header ul {
...
@@ -1180,6 +1180,9 @@ div[data-gadget-scope='header'] .ui-header ul {
.gadget-content
.ui-field-contain
>
label
{
.gadget-content
.ui-field-contain
>
label
{
color
:
hsl
(
0
,
0%
,
42%
);
color
:
hsl
(
0
,
0%
,
42%
);
}
}
.gadget-content
.ui-field-contain
>
label
>
a
{
padding-left
:
3pt
;
}
.gadget-content
.required
>
.ui-field-contain
>
label
{
.gadget-content
.required
>
.ui-field-contain
>
label
{
font-weight
:
bold
;
font-weight
:
bold
;
color
:
#1F1F1F
;
color
:
#1F1F1F
;
...
...
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/erp5css.less.txt
View file @
e3921c42
...
@@ -1365,7 +1365,10 @@ div[data-gadget-scope='header'] .ui-header {
...
@@ -1365,7 +1365,10 @@ div[data-gadget-scope='header'] .ui-header {
.ui-field-contain {
.ui-field-contain {
& > label {
& > label {
color: @colorlabel;
color: @colorlabel;
& > a {
// links inside label when dev mode is enable
padding-left: 3pt;
}
}
}
}
}
//Label styling in required and "invisible" field
//Label styling in required and "invisible" 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