public.j2 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. {% extends "layout/page.j2" %}
  2. {% block nav %}
  3. <ul class="navbar-nav mr-auto">
  4. {% for menu_item in menu %}
  5. {% if not menu_item.private %}
  6. {% if 'children' in menu_item %}
  7. <li class="nav-item dropdown">
  8. <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  9. {{ menu_item['title'] }}
  10. </a>
  11. <div class="dropdown-menu" aria-labelledby="navbarDropdown">
  12. <a class="dropdown-item" href="/{{ menu_item['url'] }}">{{ menu_item['title'] }}</a>
  13. {%- for child_menu_item in menu_item['children'] recursive -%}
  14. {% if not child_menu_item.private %}
  15. <a class="dropdown-item" href="/{{ child_menu_item['url'] }}">{{ '> ' * (loop.depth - 1) }}{{ child_menu_item['title'] }}</a>
  16. {{ loop(child_menu_item['children']) }}
  17. {% endif %}
  18. {%- endfor -%}
  19. </div>
  20. </li>
  21. {% else %}
  22. <li class="nav-item">
  23. <a class="nav-link" href="/{{ menu_item['url'] }}">{{ menu_item['title'] }}</a>
  24. </li>
  25. {% endif %}
  26. {% endif %}
  27. {% endfor %}
  28. </ul>
  29. <ul class="navbar-nav">
  30. <li class="nav-item text-nowrap">
  31. <a class="nav-link" href="/login">Login</a>
  32. </li>
  33. </ul>
  34. {% endblock %}