Skip to content

Commit

Permalink
Submenu icons display option was added.
Browse files Browse the repository at this point in the history
  • Loading branch information
stasosovskyi committed Mar 13, 2017
1 parent 493386c commit 1c0edf7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ Always reference the ticket number at the end of the issue description.
###Changed

- Added full Django 1.10 compatibility - [#164][164]
- Added submenu icons display option - [#178][178]

[164]: //github.com/sanoma/django-arctic/issues/164
[178]: //github.com/sanoma/django-arctic/issues/178


##0.9.4 (2017-02-23)
Expand Down
4 changes: 4 additions & 0 deletions arctic/generics.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def get_context_data(self, **kwargs):
context['page_title'] = self.get_page_title()
context['page_description'] = self.get_page_description()
context['menu'] = menu(user=self.request.user, request=self.request)
context['SUBMENU_ICONS_DISPLAY'] = self.get_submenu_icons_display()
context['urls'] = self.get_urls()
context['breadcrumbs'] = self.get_breadcrumbs()
context['tabs'] = self.get_tabs()
Expand Down Expand Up @@ -171,6 +172,9 @@ def get_login_url(self):
def get_logout_url(self):
return reverse(getattr(settings, 'LOGOUT_URL', 'logout'))

def get_submenu_icons_display(self):
return getattr(settings, 'SUBMENU_ICONS_DISPLAY', False)


class TemplateView(View, base.TemplateView):
pass
Expand Down
3 changes: 3 additions & 0 deletions arctic/templates/arctic/partials/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
{% for sub_key, sub_value in value.submenu.items %}
<li id="menu-{{ sub_value.url|slugify }}">
<a {% if sub_value.active %}class="active" {% endif %} href="{% url sub_value.url %}">
{% if SUBMENU_ICONS_DISPLAY %}
<i class="fa {{ sub_value.icon|default_if_none:'' }}"></i>
{% endif %}
{% trans sub_key %}
</a>
</li>
Expand Down

0 comments on commit 1c0edf7

Please sign in to comment.