private.j2 1.3 KB

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