From: Simo Sorce Date: Thu, 16 Oct 2014 00:26:24 +0000 (-0400) Subject: Update style of plugins config page too X-Git-Tag: v0.3.0~33 X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fipsilon.git;a=commitdiff_plain;h=f3575089742ba85ed420f6f9becd2cde4135097f 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 Reviewed-by: Patrick Uiterwijk --- 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,15 +65,19 @@ 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): @@ -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 %} -

{{ title }}

- {% if message %} -
-

{{ message }}

+{% if user.is_admin %} + +
+
+

{{ title }}

+
+
- {% endif %} + +
+
-
+ {% for o in options_order %}
- + +
{% set val = plugin.get_config_value(o) %} {% if val is string %} {% else %} {% endif %} + {{ plugin.get_config_desc(o) }} +
- {{ plugin.get_config_desc(o) }} +
{% endfor %} - - Back + + Back +

+ +{% endif %} {% endblock %}