modular.html.twig 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. {% extends 'partials/base.html.twig' %}
  2. {% macro pageLinkName(text) %}{{ text|lower|replace({' ':'_'}) }}{% endmacro %}
  3. {% import _self as macro %}
  4. {% set show_onpage_menu = header.onpage_menu == true or header.onpage_menu is null %}
  5. {% block javascripts %}
  6. {% if show_onpage_menu %}
  7. {% do assets.add('theme://js/singlepagenav.min.js') %}
  8. {% endif %}
  9. {{ parent() }}
  10. {% endblock %}
  11. {% block bottom %}
  12. {{ parent() }}
  13. {% endblock %}
  14. {% block header_navigation %}
  15. {% if show_onpage_menu %}
  16. <ul class="navigation">
  17. {% for module in page.collection() if module.template == 'blog' %}
  18. {% set current_module = (module.active or module.activeChild) ? 'active' : '' %}
  19. <li><a class="{{ current_module }}" href="#{{ macro.pageLinkName(module.menu)|hyphenize }}">{{ module.menu }}</a></li>
  20. {% endfor %}
  21. {% for mitem in site.menu %}
  22. <li>
  23. <a {% if mitem.class %} class="{{ mitem.class }}" {% endif %} href="{{ mitem.url }}">
  24. {% if mitem.icon %}<i class="fa fa-{{ mitem.icon }}"></i>{% endif %}
  25. {{ mitem.text }}
  26. </a>
  27. </li>
  28. {% endfor %}
  29. </ul>
  30. {% else %}
  31. {{ parent() }}
  32. {% endif %}
  33. {% endblock %}
  34. {% block hero %}
  35. {% for module in page.collection() if module.template == 'modular/hero' %}
  36. <div id="{{ macro.pageLinkName(module.menu) }}"></div>
  37. {{ module.content|raw }}
  38. {% endfor %}
  39. {% endblock %}
  40. {% block body %}
  41. <section id="{{ macro.pageLinkName(page.menu) }}" class="section">
  42. {{page.content}}
  43. </section>
  44. {% for module in page.collection() if module.template == 'blog' %}
  45. <section id="{{ macro.pageLinkName(module.menu)|hyphenize }}" class="section">
  46. <div class="content section-content">
  47. <h2>{{ module.title }}</h2>
  48. <div class="arrow"></div>
  49. {{ module.content|raw }}
  50. </div>
  51. <div class="sous-section">
  52. {% for child in module.collection %}
  53. {% set gal = child.header.blog.config %}
  54. {% if gal %}
  55. {% include 'partials/blog/sous-gal.html.twig' %}
  56. {% else %}
  57. {% include 'partials/blog/no-gal.html.twig' %}
  58. {% endif %}
  59. {% endfor %}
  60. </div>
  61. </section>
  62. {% endfor %}
  63. {% endblock %}