Translated menus
This commit is contained in:
parent
bec55a8660
commit
e6cd7c50c4
3 changed files with 9 additions and 6 deletions
|
@ -5,10 +5,10 @@
|
|||
{% for menuitem in menuitems %}
|
||||
<li class="{% if menuitem.show_dropdown %}dropdown{% endif %}{% if menuitem.active %} active{% endif %}">
|
||||
{% if menuitem.show_dropdown %}
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">{{ menuitem.trans_title }} <b class="caret"></b></a>
|
||||
<a data-toggle="dropdown" class="dropdown-toggle" href="#">{{ menuitem.title }} <b class="caret"></b></a>
|
||||
{% top_menu_children parent=menuitem %}
|
||||
{% else %}
|
||||
<a href="{% pageurl menuitem %}">{{ menuitem.trans_title }}</a>
|
||||
<a href="{% pageurl menuitem %}">{{ menuitem.title }}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{% load navigation wagtailcore_tags %}
|
||||
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="{% pageurl parent %}">{{ parent.trans_title }}</a></li>
|
||||
<!--<li><a href="{% pageurl parent %}">{{ parent.title }}</a></li>-->
|
||||
{% for child in menuitems_children %}
|
||||
<li><a href="{% pageurl child %}">{{ child.trans_title }}</a></li>
|
||||
<li><a href="{% pageurl child %}">{{ child.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
|
|
@ -25,11 +25,12 @@ def has_menu_children(page):
|
|||
# Retrieves the top menu items
|
||||
@register.inclusion_tag('tags/top_menu.html', takes_context=True)
|
||||
def top_menu(context, parent, calling_page=None):
|
||||
menuitems = parent.get_children().live().in_menu()
|
||||
menuitems = parent.get_children().live().in_menu().specific()
|
||||
for menuitem in menuitems:
|
||||
menuitem.show_dropdown = has_menu_children(menuitem)
|
||||
menuitem.active = (calling_page.url.startswith(menuitem.url)
|
||||
if calling_page else False)
|
||||
menuitem.title = menuitem.trans_title
|
||||
return {
|
||||
'calling_page': calling_page,
|
||||
'menuitems': menuitems,
|
||||
|
@ -39,7 +40,9 @@ def top_menu(context, parent, calling_page=None):
|
|||
# Retrieves the children of the top menu items for the drop downs
|
||||
@register.inclusion_tag('tags/top_menu_children.html', takes_context=True)
|
||||
def top_menu_children(context, parent):
|
||||
menuitems_children = parent.get_children().live().in_menu()
|
||||
menuitems_children = parent.get_children().live().in_menu().specific()
|
||||
for menuitem in menuitems_children:
|
||||
menuitem.title = menuitem.trans_title
|
||||
return {
|
||||
'parent': parent,
|
||||
'menuitems_children': menuitems_children,
|
||||
|
|
Loading…
Reference in a new issue