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 %}
|
{% for menuitem in menuitems %}
|
||||||
<li class="{% if menuitem.show_dropdown %}dropdown{% endif %}{% if menuitem.active %} active{% endif %}">
|
<li class="{% if menuitem.show_dropdown %}dropdown{% endif %}{% if menuitem.active %} active{% endif %}">
|
||||||
{% if menuitem.show_dropdown %}
|
{% 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 %}
|
{% top_menu_children parent=menuitem %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{% pageurl menuitem %}">{{ menuitem.trans_title }}</a>
|
<a href="{% pageurl menuitem %}">{{ menuitem.title }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{% load navigation wagtailcore_tags %}
|
{% load navigation wagtailcore_tags %}
|
||||||
|
|
||||||
<ul class="dropdown-menu">
|
<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 %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -25,11 +25,12 @@ def has_menu_children(page):
|
||||||
# Retrieves the top menu items
|
# Retrieves the top menu items
|
||||||
@register.inclusion_tag('tags/top_menu.html', takes_context=True)
|
@register.inclusion_tag('tags/top_menu.html', takes_context=True)
|
||||||
def top_menu(context, parent, calling_page=None):
|
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:
|
for menuitem in menuitems:
|
||||||
menuitem.show_dropdown = has_menu_children(menuitem)
|
menuitem.show_dropdown = has_menu_children(menuitem)
|
||||||
menuitem.active = (calling_page.url.startswith(menuitem.url)
|
menuitem.active = (calling_page.url.startswith(menuitem.url)
|
||||||
if calling_page else False)
|
if calling_page else False)
|
||||||
|
menuitem.title = menuitem.trans_title
|
||||||
return {
|
return {
|
||||||
'calling_page': calling_page,
|
'calling_page': calling_page,
|
||||||
'menuitems': menuitems,
|
'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
|
# Retrieves the children of the top menu items for the drop downs
|
||||||
@register.inclusion_tag('tags/top_menu_children.html', takes_context=True)
|
@register.inclusion_tag('tags/top_menu_children.html', takes_context=True)
|
||||||
def top_menu_children(context, parent):
|
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 {
|
return {
|
||||||
'parent': parent,
|
'parent': parent,
|
||||||
'menuitems_children': menuitems_children,
|
'menuitems_children': menuitems_children,
|
||||||
|
|
Loading…
Reference in a new issue