From 391fab3041ce4cbabf25b3fa23ad50858cce9639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Tue, 18 Sep 2012 10:45:00 +0200 Subject: [PATCH] Mix enabled and disabled forms (#1674) --- extra/modules/forms_ui.ptl | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/extra/modules/forms_ui.ptl b/extra/modules/forms_ui.ptl index 16bc8f0..c61a2f3 100644 --- a/extra/modules/forms_ui.ptl +++ b/extra/modules/forms_ui.ptl @@ -82,7 +82,7 @@ class FormsDirectory(AccessControlled, Directory): if is_admin or formdef.receiver_id in (user.roles or []): l.append(formdef) elif is_admin: - l2.append(formdef) + l.append(formdef) cats = Category.select(order_by = 'name') lists = [] @@ -94,15 +94,6 @@ class FormsDirectory(AccessControlled, Directory): if t: lists.append((None, t)) - lists_disabled = [] - for c in cats: - t = [x for x in l2 if x.category_id == c.id] - if t: - lists_disabled.append((c.name, t)) - t = [x for x in l2 if x.category_id is None] - if t: - lists_disabled.append((None, t)) - mid_term = ((len(lists) * 2) + sum([len(x[-1]) for x in lists])) / 2 count = 0 in_second_column = False @@ -130,34 +121,17 @@ class FormsDirectory(AccessControlled, Directory): if formdef.disabled: '' if is_admin: - ' (%s)' % (formdef.id, _('options')) + if formdef.disabled: + ' (%s)' % (formdef.id, _('enable')) + else: + ' (%s)' % (formdef.id, _('disable')) '' '' '' '' - if is_admin and lists_disabled: - get_response().filter['sidebar'] = self.get_sidebar(lists_disabled) get_logger().info('forms backoffice - home') - def get_sidebar [html] (self, lists_disabled): - '

%s

' % _('Available Forms') - '

' - _('Click on forms to enable them.') - '

' - for cat_name, formdefs in lists_disabled: - if cat_name: - '

%s

' % cat_name - else: - '

%s

' % _('Misc') - '' - - def _q_lookup(self, component): try: formdef = FormDef.get(component) -- 1.7.10.4