diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-03-09 15:07:37 +0100 | 
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-03-09 15:07:37 +0100 | 
| commit | 9562d0755157dffd72790b0854aba640b4f39f2f (patch) | |
| tree | 92c4303b86b19469ce909916d79714c524df4ffa | |
| parent | c737d107405e79aa0d014400231bf3470bb15f71 (diff) | |
| download | Ishtar-9562d0755157dffd72790b0854aba640b4f39f2f.tar.bz2 Ishtar-9562d0755157dffd72790b0854aba640b4f39f2f.zip  | |
QA Regen ID: change place and color
| -rw-r--r-- | ishtar_common/models_common.py | 5 | ||||
| -rw-r--r-- | ishtar_common/templatetags/window_header.py | 15 | 
2 files changed, 16 insertions, 4 deletions
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'  | 
