Commit 9817d24f authored by Jérome Perrin's avatar Jérome Perrin

ERP5JS,xhtml_style: display form groups legends

See merge request nexedi/erp5!1949
parents fbccd18f 4f84f243
Pipeline #35090 failed with stage
in 0 seconds
...@@ -1254,7 +1254,7 @@ def renderFormDefinition(form, response_dict): ...@@ -1254,7 +1254,7 @@ def renderFormDefinition(form, response_dict):
for field in form.get_fields_in_group(group['goid'], include_disabled=1): for field in form.get_fields_in_group(group['goid'], include_disabled=1):
field_list.append((field.id, {'meta_type': field.meta_type})) field_list.append((field.id, {'meta_type': field.meta_type}))
group_list.append((group['gid'], field_list)) group_list.append((group['gid'], field_list, group['gtitle']))
# some forms might not have any fields so we put empty bottom group # some forms might not have any fields so we put empty bottom group
if not group_list: if not group_list:
......
...@@ -1069,7 +1069,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin): ...@@ -1069,7 +1069,7 @@ class TestERP5Document_getHateoas_mode_traverse(ERP5HALJSONStyleSkinsMixin):
"application/hal+json" "application/hal+json"
) )
result_dict = json.loads(result) result_dict = json.loads(result)
_, group_fields = result_dict['group_list'][-1] _, group_fields, _ = result_dict['group_list'][-1]
field_names = [field_name for field_name, _ in group_fields] field_names = [field_name for field_name, _ in group_fields]
self.assertIn("form_id", field_names) self.assertIn("form_id", field_names)
self.assertIn("dialog_id", field_names) self.assertIn("dialog_id", field_names)
......
...@@ -19,8 +19,7 @@ Breaks strict compatibility: ...@@ -19,8 +19,7 @@ Breaks strict compatibility:
It is possible to specify a group id and a group title by naming a group following the It is possible to specify a group id and a group title by naming a group following the
"group id (Group Title)" pattern. In this case the group id will be used as fieldset css "group id (Group Title)" pattern. In this case the group id will be used as fieldset css
class and as tag id. The group title will be used as a legend for the fieldset. If no group class and as tag id. The group title will be used as a legend for the fieldset.
title is found, we use group id as title.
--> -->
</tal:block> </tal:block>
......
...@@ -37,8 +37,7 @@ Breaks strict compatibility: ...@@ -37,8 +37,7 @@ Breaks strict compatibility:
It is possible to specify a group id and a group title by naming a group following the It is possible to specify a group id and a group title by naming a group following the
"group id (Group Title)" pattern. In this case the group id will be used as fieldset css "group id (Group Title)" pattern. In this case the group id will be used as fieldset css
class and as tag id. The group title will be used as a legend for the fieldset. If no group class and as tag id. The group title will be used as a legend for the fieldset.
title is found, we use group id as title.
--> -->
</tal:block> </tal:block>
......
...@@ -37,8 +37,7 @@ Breaks strict compatibility: ...@@ -37,8 +37,7 @@ Breaks strict compatibility:
It is possible to specify a group id and a group title by naming a group following the It is possible to specify a group id and a group title by naming a group following the
"group id (Group Title)" pattern. In this case the group id will be used as fieldset css "group id (Group Title)" pattern. In this case the group id will be used as fieldset css
class and as tag id. The group title will be used as a legend for the fieldset. If no group class and as tag id. The group title will be used as a legend for the fieldset.
title is found, we use group id as title.
--> -->
</tal:block> </tal:block>
......
...@@ -84,9 +84,12 @@ ...@@ -84,9 +84,12 @@
function addGroup(group, rendered_document, form_definition, form_gadget, modification_dict) { function addGroup(group, rendered_document, form_definition, form_gadget, modification_dict) {
var group_name = group[0], var group_name = group[0],
field_list = group[1], field_list = group[1],
group_title = group[2],
// XXX: > Romain: fieldset will be needed later for menus // XXX: > Romain: fieldset will be needed later for menus
fieldset_element = domsugar("div", {"class": group_name}); fieldset_element = domsugar("div", {"class": group_name});
if (group_title) {
fieldset_element.appendChild(domsugar('label', {"class": "group_title"}, group_title));
}
return new RSVP.Queue() return new RSVP.Queue()
.push(function () { .push(function () {
var first_listbox_found = false; var first_listbox_found = false;
......
...@@ -342,7 +342,8 @@ table.fake tr td { ...@@ -342,7 +342,8 @@ table.fake tr td {
} }
.group_title { .group_title {
display: none; padding-bottom: 0.5em;
font-size: larger;
} }
table.fake, table.fake,
......
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
<tal:block tal:define="gid group/gid"> <tal:block tal:define="gid group/gid">
<fieldset tal:condition="python: 'hidden' not in gid and 'bottom' not in gid and 'head' not in gid" <fieldset tal:condition="python: 'hidden' not in gid and 'bottom' not in gid and 'head' not in gid"
tal:attributes="class gid;"> tal:attributes="class gid;">
<legend tal:content="group/gtitle" class="group_title" /> <legend i18n:translate="" i18n:domain="ui" tal:condition="group/gtitle" tal:content="group/gtitle" class="group_title"></legend>
<tal:block tal:repeat="field python: form.get_fields_in_group(group['goid'])"> <tal:block tal:repeat="field python: form.get_fields_in_group(group['goid'])">
<tal:block metal:use-macro="field_render" /> <tal:block metal:use-macro="field_render" />
</tal:block> </tal:block>
......
...@@ -19,8 +19,7 @@ Breaks strict compatibility: ...@@ -19,8 +19,7 @@ Breaks strict compatibility:
It is possible to specify a group id and a group title by naming a group following the It is possible to specify a group id and a group title by naming a group following the
"group id (Group Title)" pattern. In this case the group id will be used as fieldset css "group id (Group Title)" pattern. In this case the group id will be used as fieldset css
class and as tag id. The group title will be used as a legend for the fieldset. If no group class and as tag id. The group title will be used as a legend for the fieldset.
title is found, we use group id as title.
--> -->
</tal:block> </tal:block>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment