Commits

Souen BONIFACE  committed e2c89f9

Add a property `is_safe` to MenuItem class in order to allow HTML tags inside `title`

  • Participants
  • Parent commits b489972

Comments (0)

Files changed (2)

File admin_tools/menu/items.py

         django gettext functions if your application is multilingual.
         Default value: 'Untitled menu item'.
 
+    ``is_safe``
+        Boolean that determines whether the title should be escaped or not.
+        Set it to False if you want to add HTML tags inside ``title``.
+        Default value: False.
+
     ``url``
         String that contains the menu item URL.
         Default value: '#'.

File admin_tools/menu/templates/admin_tools/menu/item.html

-{% load admin_tools_menu_tags %}
 {% spaceless %}
 {% if not item.is_empty %}
 <li class="menu-item{% ifequal index 1 %} first{% endifequal %}{% if not item.enabled %} disabled{% endif %}{% if selected %} selected{% endif %}{% if item.css_classes %} {{ item.css_classes|join:' ' }}{% endif %}">
-<a href="{% if item.url and item.enabled %}{{ item.url }}{% else %}#{% endif %}"{% if item.description %} title="{{ item.description }}"{% endif %}{% if item.accesskey %} accesskey="{{ item.accesskey }}"{% endif %}>{% if item.children and item.enabled %}<span class="icon"></span>{% endif %}{{ item.title }}</a>
+<a href="{% if item.url and item.enabled %}{{ item.url }}{% else %}#{% endif %}"{% if item.description %} title="{{ item.description }}"{% endif %}{% if item.accesskey %} accesskey="{{ item.accesskey }}"{% endif %}>{% if item.children and item.enabled %}<span class="icon"></span>{% endif %}{% if item.is_safe %}{{ item.title|safe }}{% else %}{{ item.title }}{% endif %}</a>
     {% if item.children and item.enabled %}
     <ul>
         {% for child_item in item.children %}