pwa: mark current page's navigation entry as selected (#40687)

This commit is contained in:
Serghei Mihai 2020-03-16 16:42:14 +01:00
parent 7262e0e8fe
commit b85eb35b2f
2 changed files with 2 additions and 1 deletions

View File

@ -4,7 +4,7 @@
<div>
<ul>
{% for entry in entries %}
<li class="{{ entry.css_class_names }}" data-entry-pk="{{ entry.pk }}"
<li class="{{ entry.css_class_names }}{% if entry.link_page in page.get_parents_and_self %} selected{% endif %}" data-entry-pk="{{ entry.pk }}"
{% if entry.notification_count %}data-notification-count-url="{{site_base}}/api/notification/count/"{% endif %}
{% if entry.use_user_name_as_label %}data-include-user-name{% endif %}>
<a href="{% if entry.link_page_id %}{{ site_base }}{% endif %}{{ entry.get_url }}"

View File

@ -29,6 +29,7 @@ def pwa_navigation(context):
pwa_navigation_template = template.loader.get_template('combo/pwa/navigation.html')
entries = list(PwaNavigationEntry.objects.all())
context = {
'page': context['page'],
'entries': entries,
'include_user_name': bool([x for x in entries if x.use_user_name_as_label]),
'user': context.get('user'),