From 9562d0755157dffd72790b0854aba640b4f39f2f Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 9 Mar 2021 15:07:37 +0100 Subject: QA Regen ID: change place and color --- ishtar_common/models_common.py | 5 +++-- ishtar_common/templatetags/window_header.py | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'ishtar_common') diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index 17e643631..8a805d69e 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -2957,8 +2957,9 @@ class MainItem(ShortMenuItem): _("Regenerate ID"), "fa fa-key", _("regen."), - "", - True + "btn-info", + True, + 200 ) ] diff --git a/ishtar_common/templatetags/window_header.py b/ishtar_common/templatetags/window_header.py index 583101e66..8b717e65c 100644 --- a/ishtar_common/templatetags/window_header.py +++ b/ishtar_common/templatetags/window_header.py @@ -5,12 +5,22 @@ from django.utils.safestring import mark_safe register = template.Library() +def sorted_actions(extra_actions): + return [ + actions[:6] + for actions in sorted( + extra_actions, + key=lambda x: len(x) > 6 and x[6] or 1) + ] + + @register.inclusion_tag('ishtar/blocks/window_nav.html', takes_context=True) def window_nav(context, item, window_id, show_url, modify_url='', histo_url='', revert_url='', previous=None, nxt=None, pin_action=False): extra_actions = [] if hasattr(item, 'get_extra_actions'): - extra_actions = item.get_extra_actions(context['request']) + extra_actions = sorted_actions( + item.get_extra_actions(context['request'])) extra_templates = [] if hasattr(item, 'get_extra_templates'): extra_templates = item.get_extra_templates(context['request']) @@ -60,7 +70,8 @@ def window_find_nav(context, item, window_id, show_url, modify_url='', def window_file_nav(context, item, window_id, previous=None, nxt=None): extra_actions = [] if hasattr(item, 'get_extra_actions'): - extra_actions = item.get_extra_actions(context['request']) + extra_actions = sorted_actions( + item.get_extra_actions(context['request'])) show_url = 'show-file' modify_url = 'file_modify' histo_url = 'show-historized-file' -- cgit v1.2.3