From ea9b36c5a0481ff8c7956a2a94cdcf031a420a76 Mon Sep 17 00:00:00 2001 From: Marcin Kuzminski Date: Mon, 10 Dec 2018 13:47:09 +0100 Subject: [PATCH] authentication: show icons only for activated plugins. --- rhodecode/lib/helpers.py | 7 ++++--- rhodecode/templates/admin/auth/auth_settings.mako | 2 +- .../admin/permissions/permissions_auth_token_access.mako | 4 +--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py index a1deb9ac..c1d4d7a2 100644 --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -1018,7 +1018,7 @@ def style_metatag(tag_type, value): return html_value -def bool2icon(value): +def bool2icon(value, show_at_false=True): """ Returns boolean value of a given value, represented as html element with classes that will represent icons @@ -1029,8 +1029,9 @@ def bool2icon(value): if value: # does bool conversion return HTML.tag('i', class_="icon-true") else: # not true as bool - return HTML.tag('i', class_="icon-false") - + if show_at_false: + return HTML.tag('i', class_="icon-false") + return HTML.tag('i') #============================================================================== # PERMS diff --git a/rhodecode/templates/admin/auth/auth_settings.mako b/rhodecode/templates/admin/auth/auth_settings.mako index 637ebb0f..9a8a467a 100644 --- a/rhodecode/templates/admin/auth/auth_settings.mako +++ b/rhodecode/templates/admin/auth/auth_settings.mako @@ -79,7 +79,7 @@ % endif ${plugin.get_id()} - ${plugin.is_active()} + ${h.bool2icon(plugin.is_active(),show_at_false=False)} %endfor diff --git a/rhodecode/templates/admin/permissions/permissions_auth_token_access.mako b/rhodecode/templates/admin/permissions/permissions_auth_token_access.mako index 740d3e2d..bd9d9f5d 100644 --- a/rhodecode/templates/admin/permissions/permissions_auth_token_access.mako +++ b/rhodecode/templates/admin/permissions/permissions_auth_token_access.mako @@ -49,9 +49,7 @@ ${entry} % for route_name, view_fqn, view_url, active in c.view_data: - % if active: - ${h.bool2icon(active)} - % endif + ${h.bool2icon(active, show_at_false=False)} ${view_fqn} ${view_url}