modular.html.twig 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. {% extends 'partials/base.html.twig' %}
  2. {% set show_onpage_menu = header.onpage_menu == true or header.onpage_menu is null %}
  3. {% block javascripts %}
  4. {% if show_onpage_menu %}
  5. {% do assets.add('theme://js/singlepagenav.min.js') %}
  6. {% endif %}
  7. {{ parent() }}
  8. {% endblock %}
  9. {% block bottom %}
  10. {{ parent() }}
  11. {% if show_onpage_menu %}
  12. <script>
  13. // singlePageNav initialization & configuration
  14. $('ul.navigation').singlePageNav({
  15. offset: $('#header').outerHeight(),
  16. filter: ':not(.external)',
  17. updateHash: true,
  18. currentClass: 'active'
  19. });
  20. </script>
  21. {% endif %}
  22. {% endblock %}
  23. {% block header_navigation %}
  24. {% if show_onpage_menu %}
  25. <ul class="navigation">
  26. {% for module in page.collection() if module.header.visible is not same as(false) %}
  27. {% set current_module = (module.active or module.activeChild) ? 'active' : '' %}
  28. <li><a class="{{ current_module }}" href="#{{ module.menu|hyphenize }}">{{ module.menu }}</a></li>
  29. {% endfor %}
  30. {% for mitem in site.menu %}
  31. <li>
  32. <a {% if mitem.class %}class="{{ mitem.class }}"{% endif %} href="{{ mitem.url }}">
  33. {% if mitem.icon %}<i class="fa fa-{{ mitem.icon }}"></i>{% endif %}
  34. {{ mitem.text }}
  35. </a>
  36. </li>
  37. {% endfor %}
  38. </ul>
  39. {% else %}
  40. {{ parent() }}
  41. {% endif %}
  42. {% endblock %}
  43. {% block hero %}
  44. {% for module in page.collection() if module.template == 'modular/hero' %}
  45. <div id="{{ module.menu|hyphenize }}"></div>
  46. {{ module.content|raw }}
  47. {% endfor %}
  48. {% endblock %}
  49. {% block body %}
  50. {% for module in page.collection() if module.template != 'modular/hero' %}
  51. <div id="{{ module.menu|hyphenize }}"></div>
  52. {{ module.content|raw }}
  53. {% endfor %}
  54. {% endblock %}