{% load menu_tags %} {% load i18n %} {% load descendant_selected %} {# find the active page in the tree. Assume it must be a grandchild or great-grandchild of the softroot #} {% for child in children %} {# this level is the children of the softroot, e.g. Instructions, Challenges #} {% for grandchild in child.children %} {% descendant_selected grandchild as show_this_branch %} {# only show this menu if it includes a selected node #} {% if show_this_branch %} {% if grandchild.selected %} {# the first, ancestor page #}
  • «
  • 1
  • {% else %}
  • «
  • 1
  • {% endif %} {# the first ancestor page was active #} {% for ggchild in grandchild.children %}
  • {{ ggchild.get_menu_title }}
  • {% endfor %} {# now for the Next page #} {% if grandchild.selected %} {# the first, ancestor page (again!) #}
  • »
  • {% else %} {# the first, ancestor page (again!) #} {% for ggchild in grandchild.children %}{% if ggchild.selected %} {% if ggchild.get_next_sibling %}
  • »
  • {% else %}
  • »
  • {% endif %} {% endif %}{% endfor %} {% endif %} {# the first, ancestor page (again!) #} {% endif %} {# show_this_branch #} {% endfor %} {% endfor %}