modular.html.twig 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. <div class="content section-content">
  43. {{page.content}}
  44. </div>
  45. </section>
  46. {% for module in page.collection() if module.template == 'blog' %}
  47. <section id="{{ macro.pageLinkName(module.menu)|hyphenize }}" class="section">
  48. <div class="content section-content">
  49. <div class="block">
  50. <h2>{{ module.title }}</h2>
  51. <div class="arrow"></div>
  52. <div class="content">
  53. {{ module.content|raw }}
  54. </div>
  55. </div>
  56. </div>
  57. <div class="sous-section">
  58. {% for child in module.collection if child.template == 'items' %}
  59. {% include 'items.html.twig' %}
  60. {% endfor %}
  61. {% for child in module.collection if child.template == 'item-etapes' %}
  62. {% include 'item-etapes.html.twig' %}
  63. {% endfor %}
  64. {% for child in module.collection if child.template == 'blog' %}
  65. {% set gal = child.header.blog.config %}
  66. {% if gal %}
  67. {% include 'partials/sous-gal.html.twig' %}
  68. {% else %}
  69. {% include 'partials/no-gal.html.twig' %}
  70. {% endif %}
  71. {% endfor %}
  72. </div>
  73. </section>
  74. {% endfor %}
  75. {% endblock %}