Commit af788214 authored by Jérome Perrin's avatar Jérome Perrin

ERP5Form: improve formSettings

 - follow Zope4 ZMI style guide
 - remove the confusing "Upgrade" button and the associated method
 `manage_refresh` doing nothing
 - use `form-control` and `code` CSS classes for better looking fields
parent 1f52bbe5
...@@ -480,38 +480,48 @@ def create_settings_form(): ...@@ -480,38 +480,48 @@ def create_settings_form():
title = fields.StringField('title', title = fields.StringField('title',
title="Title", title="Title",
required=0, required=0,
css_class="form-control",
default="") default="")
description = fields.TextAreaField('description', description = fields.TextAreaField('description',
title="Description", title="Description",
required=0, required=0,
css_class="form-control",
default="") default="")
row_length = fields.IntegerField('row_length', row_length = fields.IntegerField('row_length',
input_type='number',
title='Number of groups in row (in order tab)', title='Number of groups in row (in order tab)',
required=1, required=1,
css_class="form-control",
default=4) default=4)
name = fields.StringField('name', name = fields.StringField('name',
title="Form name", title="Form name",
required=0, required=0,
css_class="form-control",
default="") default="")
pt = fields.StringField('pt', pt = fields.StringField('pt',
title="Page Template", title="Page Template",
required=0, required=0,
css_class="form-control code",
default="") default="")
action = fields.StringField('action', action = fields.StringField('action',
title='Form action', title='Form action',
required=0, required=0,
css_class="form-control code",
default="") default="")
action_title = fields.StringField('action_title', action_title = fields.StringField('action_title',
title="Action Title", title="Action Title",
required=0, required=0,
css_class="form-control",
default="") default="")
update_action = fields.StringField('update_action', update_action = fields.StringField('update_action',
title='Form update action', title='Form update action',
required=0, required=0,
css_class="form-control code",
default="") default="")
update_action_title = fields.StringField('update_action_title', update_action_title = fields.StringField('update_action_title',
title="Update Action Title", title="Update Action Title",
required=0, required=0,
css_class="form-control",
default="") default="")
method = fields.ListField('method', method = fields.ListField('method',
title='Form method', title='Form method',
...@@ -519,6 +529,7 @@ def create_settings_form(): ...@@ -519,6 +529,7 @@ def create_settings_form():
('GET', 'GET')], ('GET', 'GET')],
required=1, required=1,
size=1, size=1,
css_class="form-control",
default='POST') default='POST')
enctype = fields.ListField('enctype', enctype = fields.ListField('enctype',
title='Form enctype', title='Form enctype',
...@@ -529,22 +540,27 @@ def create_settings_form(): ...@@ -529,22 +540,27 @@ def create_settings_form():
'multipart/form-data')], 'multipart/form-data')],
required=0, required=0,
size=1, size=1,
css_class="form-control",
default=None) default=None)
encoding = fields.StringField('encoding', encoding = fields.StringField('encoding',
title='Encoding of pages the form is in', title='Encoding of pages the form is in',
default="UTF-8", default="UTF-8",
css_class="form-control",
required=1) required=1)
stored_encoding = fields.StringField('stored_encoding', stored_encoding = fields.StringField('stored_encoding',
title='Encoding of form properties', title='Encoding of form properties',
default='UTF-8', default='UTF-8',
css_class="form-control",
required=1) required=1)
unicode_mode = fields.CheckBoxField('unicode_mode', unicode_mode = fields.CheckBoxField('unicode_mode',
title='Form properties are unicode', title='Form properties are unicode',
default=0, default=0,
css_class="form-control",
required=0) required=0)
edit_order = fields.LinesField('edit_order', edit_order = fields.LinesField('edit_order',
title='Setters for these properties should be' title='Setters for these properties should be'
'<br /> called by edit() in the defined order') '<br /> called by edit() in the defined order',
css_class="form-control code")
form.add_fields([title, description, row_length, name, pt, action, action_title, update_action, update_action_title, form.add_fields([title, description, row_length, name, pt, action, action_title, update_action, update_action_title,
method, enctype, encoding, stored_encoding, unicode_mode, edit_order]) method, enctype, encoding, stored_encoding, unicode_mode, edit_order])
......
...@@ -50,6 +50,7 @@ def create_settings_form(): ...@@ -50,6 +50,7 @@ def create_settings_form():
title='Report Method', title='Report Method',
description=('The method to get a list of items (object, form,' description=('The method to get a list of items (object, form,'
' parameters) to aggregate in a single Report'), ' parameters) to aggregate in a single Report'),
css_class="form-control code",
default='', default='',
required=0) required=0)
......
...@@ -578,18 +578,22 @@ def create_settings_form(): ...@@ -578,18 +578,22 @@ def create_settings_form():
title = fields.StringField('title', title = fields.StringField('title',
title="Title", title="Title",
required=False, required=False,
css_class="form-control",
default="") default="")
row_length = fields.IntegerField('row_length', row_length = fields.IntegerField('row_length',
title='Number of groups in row (in order tab)', title='Number of groups in row (in order tab)',
required=True, required=True,
css_class="form-control",
default=4) default=4)
name = fields.StringField('name', name = fields.StringField('name',
title="Form name", title="Form name",
required=False, required=False,
css_class="form-control",
default="") default="")
action = fields.StringField('action', action = fields.StringField('action',
title='Form action', title='Form action',
required=False, required=False,
css_class="form-control",
default="") default="")
method = fields.ListField('method', method = fields.ListField('method',
title='Form method', title='Form method',
...@@ -597,6 +601,7 @@ def create_settings_form(): ...@@ -597,6 +601,7 @@ def create_settings_form():
('GET', 'GET')], ('GET', 'GET')],
required=True, required=True,
size=1, size=1,
css_class="form-control",
default='POST') default='POST')
enctype = fields.ListField('enctype', enctype = fields.ListField('enctype',
title='Form enctype', title='Form enctype',
...@@ -607,20 +612,24 @@ def create_settings_form(): ...@@ -607,20 +612,24 @@ def create_settings_form():
'multipart/form-data')], 'multipart/form-data')],
required=False, required=False,
size=1, size=1,
css_class="form-control",
default=None) default=None)
encoding = fields.StringField('encoding', encoding = fields.StringField('encoding',
title='Encoding of pages the form is in', title='Encoding of pages the form is in',
default="UTF-8", default="UTF-8",
css_class="form-control",
required=True) required=True)
stored_encoding = fields.StringField('stored_encoding', stored_encoding = fields.StringField('stored_encoding',
title='Encoding of form properties', title='Encoding of form properties',
default='ISO-8859-1', default='ISO-8859-1',
css_class="form-control",
required=True) required=True)
unicode_mode = fields.CheckBoxField('unicode_mode', unicode_mode = fields.CheckBoxField('unicode_mode',
title='Form properties are unicode', title='Form properties are unicode',
default=False, default=False,
css_class="form-control",
required=True) required=True)
form.add_fields([title, row_length, name, action, method, form.add_fields([title, row_length, name, action, method,
...@@ -820,14 +829,6 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form): ...@@ -820,14 +829,6 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
return self.formSettings(self, REQUEST, return self.formSettings(self, REQUEST,
manage_tabs_message=message) manage_tabs_message=message)
security.declareProtected('Change Formulator Forms', 'manage_refresh')
def manage_refresh(self, REQUEST):
"""Refresh internal data structures of this form.
FIXME: this doesn't work right now
"""
# self.update_groups()
REQUEST.RESPONSE.redirect('manage_main')
security.declarePrivate('_get_field_ids') security.declarePrivate('_get_field_ids')
def _get_field_ids(self, group, REQUEST): def _get_field_ids(self, group, REQUEST):
"""Get the checked field_ids that we're operating on """Get the checked field_ids that we're operating on
......
<dtml-var manage_page_header> <dtml-var manage_page_header>
<dtml-var manage_tabs> <dtml-var manage_tabs>
<main class="container-fluid">
<p class="form-help"> <p class="form-help">
Settings for this form. Settings for this form.
</p> </p>
...@@ -9,7 +10,7 @@ Settings for this form. ...@@ -9,7 +10,7 @@ Settings for this form.
<dtml-var "settings_form.header()"> <dtml-var "settings_form.header()">
<table border="0"> <table class="table table-striped table-hover table-sm">
<dtml-in "settings_form.get_fields()"><dtml-let field=sequence-item> <dtml-in "settings_form.get_fields()"><dtml-let field=sequence-item>
<tr> <tr>
<td class="form-label"><dtml-var "field.get_value('title')"></td> <td class="form-label"><dtml-var "field.get_value('title')"></td>
...@@ -17,18 +18,14 @@ Settings for this form. ...@@ -17,18 +18,14 @@ Settings for this form.
</tr> </tr>
</dtml-let></dtml-in> </dtml-let></dtml-in>
<tr>
<td><input type="submit" value="Change"></td>
</tr>
</table> </table>
<div class="zmi-controls">
<input class="btn btn-primary" type="submit" name="submit" value="Change" />
</div>
<dtml-var "settings_form.footer()"> <dtml-var "settings_form.footer()">
</dtml-let> </dtml-let>
<p>Upgrade</p> </main>
<form action="manage_refresh" method="POST">
<p><input type="submit" value="Upgrade"></p>
</form>
<dtml-var manage_page_footer> <dtml-var manage_page_footer>
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