--- a/src/pyams_form/group.py Wed Sep 20 12:13:36 2017 +0200
+++ b/src/pyams_form/group.py Thu Sep 21 14:29:32 2017 +0200
@@ -33,6 +33,7 @@
id = FieldProperty(IFormWidgetsGroup['id'])
widgets = FieldProperty(IFormWidgetsGroup['widgets'])
bordered = FieldProperty(IFormWidgetsGroup['bordered'])
+ fieldset_class = FieldProperty(IFormWidgetsGroup['fieldset_class'])
legend = FieldProperty(IFormWidgetsGroup['legend'])
help = FieldProperty(IFormWidgetsGroup['help'])
_css_class = FieldProperty(IFormWidgetsGroup['css_class'])
@@ -44,13 +45,15 @@
hide_if_empty = FieldProperty(IFormWidgetsGroup['hide_if_empty'])
subforms_legend = FieldProperty(IFormWidgetsGroup['subforms_legend'])
- def __init__(self, form, id, widgets=None, bordered=True, legend=None, help=None, css_class='', switch=False,
- checkbox_switch=False, checkbox_field=None, checkbox_mode='hide', hide_if_empty=False):
+ def __init__(self, form, id, widgets=None, bordered=True, fieldset_class=None, legend=None, help=None,
+ css_class='', switch=False, checkbox_switch=False, checkbox_field=None, checkbox_mode='hide',
+ hide_if_empty=False):
assert (not checkbox_switch) or checkbox_field, "You must define checkbox field when using checkbox switch"
self.form = form
self.id = id
self.widgets = widgets or []
self.bordered = bordered
+ self.fieldset_class = fieldset_class
self.legend = legend
self.help = help
self._css_class = css_class
@@ -111,7 +114,7 @@
@property
def switcher_state(self):
- return 'on' if self.visible else 'off'
+ return 'open' if self.visible else 'off'
@property
def checker_state(self):
@@ -126,11 +129,12 @@
key=get_form_weight)
-def NamedWidgetsGroup(form, id, widgets, names=(), bordered=True, legend=None, help=None, css_class='', switch=False,
- checkbox_switch=False, checkbox_field=None, checkbox_mode='hide', hide_if_empty=False):
+def NamedWidgetsGroup(form, id, widgets, names=(), bordered=True, fieldset_class=None, legend=None, help=None,
+ css_class='', switch=False, checkbox_switch=False, checkbox_field=None, checkbox_mode='hide',
+ hide_if_empty=False):
"""Create a widgets group based on widgets names"""
- return FormWidgetsGroup(form, id, [widgets.get(name) for name in names], bordered, legend, help, css_class, switch,
- checkbox_switch, checkbox_field, checkbox_mode, hide_if_empty)
+ return FormWidgetsGroup(form, id, [widgets.get(name) for name in names], bordered, fieldset_class, legend, help,
+ css_class, switch, checkbox_switch, checkbox_field, checkbox_mode, hide_if_empty)
@implementer(IGroupsBasedForm)