From 1d4702037d5502181fbac18a9f23f462b7167535 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nikola=20Forr=C3=B3?= Date: Sat, 12 May 2018 14:15:25 +0200 Subject: [PATCH] Use dropmenu for single page navigation --- templates/modular.html.twig | 51 ++++++++----------------- templates/partials/base.html.twig | 1 + templates/partials/navigation.html.twig | 19 +++++++++ 3 files changed, 35 insertions(+), 36 deletions(-) diff --git a/templates/modular.html.twig b/templates/modular.html.twig index 2d7d69c..90373db 100644 --- a/templates/modular.html.twig +++ b/templates/modular.html.twig @@ -1,50 +1,27 @@ {% extends 'partials/base.html.twig' %} -{% set show_onpage_menu = header.onpage_menu == true or header.onpage_menu is null %} {% macro pageLinkName(text) %}{{ text|lower|replace({' ':'_'}) }}{% endmacro %} {% block javascripts %} - {% if show_onpage_menu %} - {% do assets.add('theme://js/singlepagenav.min.js') %} - {% endif %} + {% do assets.add('theme://js/singlepagenav.min.js') %} + {{ parent() }} + {% endblock %} {% block bottom %} {{ parent() }} - {% if show_onpage_menu %} - - {% endif %} -{% endblock %} -{% block header_navigation %} - {% if show_onpage_menu %} - - {% else %} - {{ parent() }} - {% endif %} + + {% endblock %} {% block hero %} @@ -52,6 +29,7 @@
{{ module.content }} {% endfor %} + {% endblock %} {% block body %} @@ -59,4 +37,5 @@
{{ module.content }} {% endfor %} + {% endblock %} diff --git a/templates/partials/base.html.twig b/templates/partials/base.html.twig index 707965a..1687ec3 100644 --- a/templates/partials/base.html.twig +++ b/templates/partials/base.html.twig @@ -106,6 +106,7 @@ {% block bottom %} {{ assets.js('bottom') }} + {% endblock %} diff --git a/templates/partials/navigation.html.twig b/templates/partials/navigation.html.twig index d81eed6..5ac2ec4 100644 --- a/templates/partials/navigation.html.twig +++ b/templates/partials/navigation.html.twig @@ -1,6 +1,9 @@ +{% macro pageLinkName(text) %}{{ text|lower|replace({' ':'_'}) }}{% endmacro %} + {% macro nav_loop(page) %} {% for p in page.children.visible %} {% set active_page = (p.active or p.activeChild) ? 'active' : '' %} + {% set modules = p.collection() %} {% if p.children.visible.count > 0 %}
  • @@ -10,6 +13,22 @@ {{ _self.nav_loop(p) }}
  • + {% elseif modules.count > 0 %} +
  • + + {{ p.menu }} + + +
  • {% else %}