From 494481c500b77d367b9cf5906d478e14ed575b81 Mon Sep 17 00:00:00 2001 From: Dain Nilsson Date: Fri, 26 Apr 2013 16:48:38 +0200 Subject: [PATCH] Improved layout of forms. --- static/css/main.css | 4 ++++ templates/form.html | 9 ++++++--- yubiadmin/apps/val.py | 20 ++++++++++++++------ yubiadmin/util/form.py | 9 +++++---- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/static/css/main.css b/static/css/main.css index 0b3fab0..f76b1b8 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -6,3 +6,7 @@ html { overflow: -moz-scrollbars-vertical; overflow-y: scroll; } + +label { + font-weight: bold; +} diff --git a/templates/form.html b/templates/form.html index de5e909..328dff1 100644 --- a/templates/form.html +++ b/templates/form.html @@ -7,7 +7,7 @@ {%- macro form_field_description(field) -%} {% if field.description %} - {{ field.description }} + {{ field.description }} {% endif %} {%- endmacro -%} @@ -42,6 +42,7 @@ {% else %} {{ form_field_label(field) }}
+ {{ form_field_description(field) }} {% if field.type == 'RadioField' %} {{ field(class='radio-group', **attrs) }} {% elif field.type == 'IntegerField' %} @@ -49,7 +50,6 @@ {% else %} {{ field(**attrs) }} {% endif %} - {{ form_field_description(field) }} {{ form_field_errors(field) }}
{% endif %} @@ -60,7 +60,10 @@ {%- macro form_fieldset(fieldset) -%}
{% if fieldset.legend %} - {{fieldset.legend}} + {{ fieldset.legend }} + {% endif %} + {% if fieldset.description %} +

{{ fieldset.description }}

{% endif %} {% for field in fieldset %} {% if field.type == 'HiddenField' %} diff --git a/yubiadmin/apps/val.py b/yubiadmin/apps/val.py index 4ef6aad..46903a6 100644 --- a/yubiadmin/apps/val.py +++ b/yubiadmin/apps/val.py @@ -75,11 +75,12 @@ ykval_config = FileConfig( class SyncLevelsForm(ConfigForm): legend = 'Sync Levels' + description = 'Percentage of syncing required for pre-defined levels.' config = ykval_config - sync_default = IntegerField('Default', [NumberRange(1, 100)]) - sync_secure = IntegerField('Secure', [NumberRange(1, 100)]) - sync_fast = IntegerField('Fast', [NumberRange(1, 100)]) + sync_default = IntegerField('Default Level', [NumberRange(1, 100)]) + sync_secure = IntegerField('Secure Level', [NumberRange(1, 100)]) + sync_fast = IntegerField('Fast Level', [NumberRange(1, 100)]) class MiscForm(ConfigForm): @@ -97,11 +98,18 @@ class SyncPoolForm(ConfigForm): 'allowed_sync_pool': {'rows': 5, 'class': 'input-xlarge'} } - sync_interval = IntegerField('Sync Interval', [NumberRange(1)]) + sync_interval = IntegerField( + 'Sync Interval', [NumberRange(1)], + description='How often (in seconds) to sync with other server.') resync_timeout = IntegerField('Resync Timeout', [NumberRange(1)]) old_limit = IntegerField('Old Limit', [NumberRange(1)]) - sync_pool = ListField('Sync Pool URLs', [URL()]) - allowed_sync_pool = ListField('Allowed Sync IPs', [IPAddress()]) + sync_pool = ListField( + 'Sync Pool URLs', [URL()], + description='List of URLs to other servers in the sync pool.') + allowed_sync_pool = ListField( + 'Allowed Sync IPs', [IPAddress()], + description='List of IP-addresses of other servers that are ' + + 'allowed to sync with this server.') class YubikeyVal(App): diff --git a/yubiadmin/util/form.py b/yubiadmin/util/form.py index b3919dc..55e46e6 100644 --- a/yubiadmin/util/form.py +++ b/yubiadmin/util/form.py @@ -62,12 +62,13 @@ class DBConfigForm(ConfigForm): Complete form for editing a dbconfig-common generated for PHP. """ legend = 'Database' - dbtype = StringField('DB type') + description = 'Settings for connecting to the database.' + dbtype = StringField('Database type') dbserver = StringField('Host') dbport = IntegerField('Port', [Optional(), NumberRange(1, 65535)]) - dbname = StringField('DB name') - dbuser = StringField('DB username') - dbpass = PasswordField('DB password', + dbname = StringField('Database name') + dbuser = StringField('Username') + dbpass = PasswordField('Password', widget=PasswordInput(hide_value=False)) def db_handler(self, varname, default):