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():
title = fields.StringField('title',
title="Title",
required=0,
css_class="form-control",
default="")
description = fields.TextAreaField('description',
title="Description",
required=0,
css_class="form-control",
default="")
row_length = fields.IntegerField('row_length',
input_type='number',
title='Number of groups in row (in order tab)',
required=1,
css_class="form-control",
default=4)
name = fields.StringField('name',
title="Form name",
required=0,
css_class="form-control",
default="")
pt = fields.StringField('pt',
title="Page Template",
required=0,
css_class="form-control code",
default="")
action = fields.StringField('action',
title='Form action',
required=0,
css_class="form-control code",
default="")
action_title = fields.StringField('action_title',
title="Action Title",
required=0,
css_class="form-control",
default="")
update_action = fields.StringField('update_action',
title='Form update action',
required=0,
css_class="form-control code",
default="")
update_action_title = fields.StringField('update_action_title',
title="Update Action Title",
required=0,
css_class="form-control",
default="")
method = fields.ListField('method',
title='Form method',
......@@ -519,6 +529,7 @@ def create_settings_form():
('GET', 'GET')],
required=1,
size=1,
css_class="form-control",
default='POST')
enctype = fields.ListField('enctype',
title='Form enctype',
......@@ -529,22 +540,27 @@ def create_settings_form():
'multipart/form-data')],
required=0,
size=1,
css_class="form-control",
default=None)
encoding = fields.StringField('encoding',
title='Encoding of pages the form is in',
default="UTF-8",
css_class="form-control",
required=1)
stored_encoding = fields.StringField('stored_encoding',
title='Encoding of form properties',
default='UTF-8',
css_class="form-control",
required=1)
unicode_mode = fields.CheckBoxField('unicode_mode',
title='Form properties are unicode',
default=0,
css_class="form-control",
required=0)
edit_order = fields.LinesField('edit_order',
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,
method, enctype, encoding, stored_encoding, unicode_mode, edit_order])
......
......@@ -50,6 +50,7 @@ def create_settings_form():
title='Report Method',
description=('The method to get a list of items (object, form,'
' parameters) to aggregate in a single Report'),
css_class="form-control code",
default='',
required=0)
......
......@@ -578,18 +578,22 @@ def create_settings_form():
title = fields.StringField('title',
title="Title",
required=False,
css_class="form-control",
default="")
row_length = fields.IntegerField('row_length',
title='Number of groups in row (in order tab)',
required=True,
css_class="form-control",
default=4)
name = fields.StringField('name',
title="Form name",
required=False,
css_class="form-control",
default="")
action = fields.StringField('action',
title='Form action',
required=False,
css_class="form-control",
default="")
method = fields.ListField('method',
title='Form method',
......@@ -597,6 +601,7 @@ def create_settings_form():
('GET', 'GET')],
required=True,
size=1,
css_class="form-control",
default='POST')
enctype = fields.ListField('enctype',
title='Form enctype',
......@@ -607,20 +612,24 @@ def create_settings_form():
'multipart/form-data')],
required=False,
size=1,
css_class="form-control",
default=None)
encoding = fields.StringField('encoding',
title='Encoding of pages the form is in',
default="UTF-8",
css_class="form-control",
required=True)
stored_encoding = fields.StringField('stored_encoding',
title='Encoding of form properties',
default='ISO-8859-1',
css_class="form-control",
required=True)
unicode_mode = fields.CheckBoxField('unicode_mode',
title='Form properties are unicode',
default=False,
css_class="form-control",
required=True)
form.add_fields([title, row_length, name, action, method,
......@@ -820,14 +829,6 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
return self.formSettings(self, REQUEST,
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')
def _get_field_ids(self, group, REQUEST):
"""Get the checked field_ids that we're operating on
......
<dtml-var manage_page_header>
<dtml-var manage_tabs>
<main class="container-fluid">
<p class="form-help">
Settings for this form.
</p>
......@@ -9,7 +10,7 @@ Settings for this form.
<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>
<tr>
<td class="form-label"><dtml-var "field.get_value('title')"></td>
......@@ -17,18 +18,14 @@ Settings for this form.
</tr>
</dtml-let></dtml-in>
<tr>
<td><input type="submit" value="Change"></td>
</tr>
</table>
<div class="zmi-controls">
<input class="btn btn-primary" type="submit" name="submit" value="Change" />
</div>
<dtml-var "settings_form.footer()">
</dtml-let>
<p>Upgrade</p>
<form action="manage_refresh" method="POST">
<p><input type="submit" value="Upgrade"></p>
</form>
</main>
<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