diff options
author | Simo Sorce <simo@redhat.com> | 2014-10-15 20:26:24 -0400 |
---|---|---|
committer | Patrick Uiterwijk <puiterwijk@redhat.com> | 2014-10-27 16:31:41 +0100 |
commit | f3575089742ba85ed420f6f9becd2cde4135097f (patch) | |
tree | c21c31c127c8e2eaf853c80a9abe56e3ac9e1296 | |
parent | 3a81575a4625576895958c9a21c8b6c64307fcb9 (diff) | |
download | ipsilon-f3575089742ba85ed420f6f9becd2cde4135097f.tar.gz ipsilon-f3575089742ba85ed420f6f9becd2cde4135097f.tar.xz ipsilon-f3575089742ba85ed420f6f9becd2cde4135097f.zip |
Update style of plugins config page too
Also fix a bug that would cause the config page to show no fields
when saving.
Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Patrick Uiterwijk <puiterwijk@redhat.com>
-rwxr-xr-x | ipsilon/admin/common.py | 19 | ||||
-rw-r--r-- | templates/admin/plugin_config.html | 40 |
2 files changed, 38 insertions, 21 deletions
diff --git a/ipsilon/admin/common.py b/ipsilon/admin/common.py index b3c318b..4d69bcd 100755 --- a/ipsilon/admin/common.py +++ b/ipsilon/admin/common.py @@ -65,16 +65,20 @@ class AdminPluginConfig(AdminPage): for k in add: self.options_order.append(k) - @admin_protect - def GET(self, *args, **kwargs): + def root_with_msg(self, message=None, message_type=None): return self._template('admin/plugin_config.html', title=self.title, + menu=self.menu, action=self.url, back=self.back, + message=message, message_type=message_type, name='admin_%s_%s_form' % (self.facility, self._po.name), - menu=self.menu, action=self.url, back=self.back, options_order=self.options_order, plugin=self._po) @admin_protect + def GET(self, *args, **kwargs): + return self.root_with_msg() + + @admin_protect def POST(self, *args, **kwargs): message = "Nothing was modified." @@ -106,13 +110,8 @@ class AdminPluginConfig(AdminPage): # And only if it succeeds we change the live object self._po.refresh_plugin_config(self.facility) - return self._template('admin/plugin_config.html', title=self.title, - message=message, - message_type=message_type, - name='admin_%s_%s_form' % (self.facility, - self._po.name), - menu=self.menu, action=self.url, - plugin=self._po) + return self.root_with_msg(message=message, + message_type=message_type) class AdminPluginsOrder(AdminPage): diff --git a/templates/admin/plugin_config.html b/templates/admin/plugin_config.html index e722aa1..1372f55 100644 --- a/templates/admin/plugin_config.html +++ b/templates/admin/plugin_config.html @@ -1,31 +1,49 @@ {% extends "master-admin.html" %} {% block main %} - <h2>{{ title }}</h2> - {% if message %} - <div class="alert alert-{{message_type}}"> - <p>{{ message }}</p> +{% if user.is_admin %} + + <div class = "row"> + <div class="col-md-3 col-sm-3 col-xs-6"> + <h2>{{ title }}</h2> + </div> + <div class="col-md-3 col-sm-3 col-xs-6" role="alert"> + {% if message %} + <div class="alert alert-{{message_type}}"> + <p>{{ message }}</p> + </div> + {% endif %} + </div> </div> - {% endif %} + + <hr> + <div id="options"> - <form role="form" id="{{ name }}" action="{{ action }}" method="post" enctype="application/x-www-form-urlencoded"> + <form class="form-horizontal" role="form" id="{{ name }}" action="{{ action }}" method="post" enctype="application/x-www-form-urlencoded"> {% for o in options_order %} <div class="form-group"> - <label for="{{ o }}">{{ o }}:</label> + <label class="col-sm-2" for="{{ o }}">{{ o }}:</label> + <div class="col-sm-10"> {% set val = plugin.get_config_value(o) %} {% if val is string %} <input type="text" class="form-control" name="{{ o }}" value="{{ val }}"> {% else %} <input type="text" class="form-control" name="{{ o }}" value="{{ val|join(', ') }}"> {% endif %} + <span class="help-block">{{ plugin.get_config_desc(o) }}</span> + </div> </div> - <span class="help-block">{{ plugin.get_config_desc(o) }}</span> + <hr> {% endfor %} - <button id="submit" class="btn btn-primary" name="submit" type="submit" value="Submit"> + <p> + <button id="submit" class="btn btn-primary" name="submit" type="submit" value="Submit"> Save - </button> - <a href="{{ back }}" class="btn btn-default" title="Back">Back</a> + </button> + <a href="{{ back }}" class="btn btn-default" title="Back">Back</a> + </p> </form> </div> + +{% endif %} {% endblock %} |