diff --git a/mayan/apps/navigation/classes.py b/mayan/apps/navigation/classes.py index 10eca136e8..e185ae520d 100644 --- a/mayan/apps/navigation/classes.py +++ b/mayan/apps/navigation/classes.py @@ -42,13 +42,14 @@ class Link(object): def remove(cls, name): del cls._registry[name] - def __init__(self, text, view=None, args=None, condition=None, + def __init__(self, text=None, view=None, args=None, badge_text=None, condition=None, conditional_disable=None, description=None, html_data=None, html_extra_classes=None, icon=None, icon_class=None, keep_query=False, kwargs=None, name=None, permission=None, remove_from_query=None, tags=None, url=None): self.args = args or [] + self.badge_text = badge_text self.condition = condition self.conditional_disable = conditional_disable self.description = description @@ -460,6 +461,11 @@ class ResolvedLink(object): def active(self): return self.link.view == self.current_view_name + @property + def badge_text(self): + if self.link.badge_text: + return self.link.badge_text(context=self.context) + @property def description(self): return self.link.description diff --git a/mayan/apps/navigation/templates/navigation/generic_link_instance.html b/mayan/apps/navigation/templates/navigation/generic_link_instance.html index 8c82ae6bf3..9db31c1367 100644 --- a/mayan/apps/navigation/templates/navigation/generic_link_instance.html +++ b/mayan/apps/navigation/templates/navigation/generic_link_instance.html @@ -13,6 +13,11 @@ {% endfor %} href="{{ link.url }}" - >{% if link.icon %}{% if not hide_icon %}{% endif %}{% endif %}{% if link.icon_class and not hide_icon %}{{ link.icon_class.render }}{% endif %} {{ link.text }}{% if link.error %} - {{ link.error }}{% endif %}{% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %} + >{% if link.icon %}{% if not hide_icon %} + + {% endif %}{% endif %} + {% if link.icon_class and not hide_icon %}{{ link.icon_class.render }}{% endif %} + {{ link.text|default:'' }}{% if link.badge_text %}{{ link.badge_text }}{% endif %}{% if link.error %} - {{ link.error }}{% endif %} + {% if horizontal %}{% if not forloop.last %} {% endif %}{% endif %} {% endif %} {% endif %}