From 11e8201a9d150b1c83649bf840cfef2b0354e185 Mon Sep 17 00:00:00 2001 From: "Ivan.Nginx" Date: Sat, 3 Mar 2018 22:06:50 +0300 Subject: [PATCH] Added sub-menu feature. 1. Added dynamic sub-menu option in main `menu` option within hierarchy structure. 2. Added select class in menu items for all possible sub-menu's (utils.js). 3. Removed `float: right` menu style in Mist scheme for better sub-menu(s) alignment. --- layout/_layout.swig | 3 + layout/_macro/menu/menu-badge-1.swig | 7 ++ layout/_macro/menu/menu-badge-2.swig | 25 ++++++ layout/_macro/menu/menu-item.swig | 10 +++ layout/_partials/header.swig | 51 ++++++------- layout/_partials/sub-menu.swig | 92 +++++++++++++++++++++++ source/css/_schemes/Gemini/index.styl | 20 +++++ source/css/_schemes/Mist/_menu.styl | 2 +- source/css/_schemes/Pisces/_sub-menu.styl | 31 ++++++++ source/css/_schemes/Pisces/index.styl | 1 + source/js/src/utils.js | 18 ++++- 11 files changed, 229 insertions(+), 31 deletions(-) create mode 100644 layout/_macro/menu/menu-badge-1.swig create mode 100644 layout/_macro/menu/menu-badge-2.swig create mode 100644 layout/_macro/menu/menu-item.swig create mode 100644 layout/_partials/sub-menu.swig create mode 100644 source/css/_schemes/Pisces/_sub-menu.styl diff --git a/layout/_layout.swig b/layout/_layout.swig index f81254451a..9e9d0e910d 100644 --- a/layout/_layout.swig +++ b/layout/_layout.swig @@ -33,6 +33,9 @@
+ {% if theme.scheme === 'Pisces' || theme.scheme === 'Gemini' %} + {% include '_partials/sub-menu.swig' %} + {% endif %}
{% block content %}{% endblock %}
diff --git a/layout/_macro/menu/menu-badge-1.swig b/layout/_macro/menu/menu-badge-1.swig new file mode 100644 index 0000000000..cfde7ae7b1 --- /dev/null +++ b/layout/_macro/menu/menu-badge-1.swig @@ -0,0 +1,7 @@ + {% macro render(value) %} + +{% endmacro %} diff --git a/layout/_macro/menu/menu-item.swig b/layout/_macro/menu/menu-item.swig new file mode 100644 index 0000000000..452193ea48 --- /dev/null +++ b/layout/_macro/menu/menu-item.swig @@ -0,0 +1,10 @@ +{% macro render(name, value) %} + +{% endmacro %} diff --git a/layout/_partials/header.swig b/layout/_partials/header.swig index 84697e3bbc..d6aec49d41 100644 --- a/layout/_partials/header.swig +++ b/layout/_partials/header.swig @@ -1,3 +1,7 @@ +{% import '../_macro/menu/menu-item.swig' as menu_item %} +{% import '../_macro/menu/menu-badge-1.swig' as menu_badge_1 %} +{% import '../_macro/menu/menu-badge-2.swig' as menu_badge_2 %} +
{% if theme.custom_logo.image and theme.scheme === 'Muse' %} @@ -10,7 +14,7 @@ {% endif %}
- + {{ config.title }} @@ -38,32 +42,21 @@ {% if theme.menu %} {% endif %} + {% if theme.scheme === 'Muse' || theme.scheme === 'Mist' %} + {% include 'sub-menu.swig' %} + {% endif %} + {% if hasSearch %}