regenerate: true
{% capture cache %}
{% comment %}
# ----------------------------------------------------------------------------- # ~/assets/data/menu.html # Liquid procedure to generate HTML portion of the main menu bar # NOTE: Loaded dynamically by J1 NAV Manager module (AJAX) # # Product/Info: # https://jekyll-one.com # # Copyright (C) 2019 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one/j1_template_mde/blob/master/LICENSE # # ----------------------------------------------------------------------------- # Test data: # {{ variable | debug }} # # -----------------------------------------------------------------------------
{% endcomment %}
{% comment %} Liquid procedures ——————————————————————————– {% endcomment %} {% capture select_color %}themes/{{site.template.name}}/procedures/global/select_color.proc{% endcapture %} {% capture select_icon_size %}themes/{{site.template.name}}/procedures/global/select_icon_size.proc{% endcapture %}
{% comment %} Liquid var initialization ——————————————————————————– {% endcomment %}
{% comment %} Set config files ——————————————————————————– {% endcomment %} {% assign navigator_config = site.data.modules.j1_navigator %} {% assign navigator_menu_config = site.data.modules.j1_navigator_menu %} {% assign nav_defaults = navigator_config.defaults %} {% assign themeswitcher_config = site.data.modules.j1_theme_switcher %}
{% comment %} Set config data ——————————————————————————– {% endcomment %} {% assign nav_bar_defaults = nav_defaults.nav_bar %} {% assign nav_bar_config = navigator_config.nav_bar %} {% assign nav_menu_defaults = nav_defaults.nav_menu %} {% assign nav_menu_config = navigator_config.nav_menu %}
{% comment %} Set config options ——————————————————————————– {% endcomment %} {% assign nav_bar_options = nav_bar_defaults | merge: nav_bar_config %} {% assign nav_menu_options = nav_menu_defaults | merge: nav_menu_config %} {% assign theme_preview = themeswitcher_config.previewPage %}
{% comment %} Set global settings
——————————————————————————– {% endcomment %}
{% assign nav_id = "navigator_nav" %} {% capture menu_id %}{{nav_id}}_menu{% endcapture %} {% assign ext = '' %} {% if site.permalink == 'none' %} {% assign ext = '.html' %} {% endif %} <!-- [DEBUG ] [j1.modules.navigator.menu.html ] [detect bs type] --> {% assign bs_type = 'bmd4' %} {% if navigator_config.bs_type == 'bs4' %} {% assign bs_type = 'bs4' %} {% endif %} {% if bs_type == 'bmd4' %} {% assign dropdown_collapse = 'collapse' %} {% elsif bs_type == 'bs4' %} {% assign dropdown_collapse = 'fake-class collapse' %} {% endif %} <!-- [DEBUG ] [j1.modules.navigator.menu.html ] [bs type detected: {{bs_type}}] --> {% comment %} Set navBarOptions ------------------------------------------------------------------------------ {% endcomment %} {% assign nav_bar_position = nav_bar_options.position %} {% comment %} Set navMenuOptions ------------------------------------------------------------------------------ {% endcomment %} {% assign nav_menu_animation = nav_menu_options.dropdown_animate %} {% if nav_menu_animation %} {% assign animate_in = nav_menu_options.dropdown_animate_in %} {% assign animate_out = nav_menu_options.dropdown_animate_out %} {% endif %} {% comment %} Set base nav features ------------------------------------------------------------------------------ {% endcomment %} {% capture nav_menu_position %}dropdown-menu-{{nav_bar_position}}{% endcapture %} {% unless nav_menu_animation %} {% assign nav_menu_animation = false %} {% endunless %} <!-- [DEBUG ] [j1.modules.navigator.menu.html ] [initialize default menu properties] --> {% if nav_menu_options.raised_level %} {% assign raised_level = nav_menu_options.raised_level %} {% else %} {% assign raised_level = 0 %} {% endif %} {% comment %} Set base icons and sizes ------------------------------------------------------------------------------ {% endcomment %} <!-- [DEBUG ] [j1.modules.navigator.menu.html ] [initialize default menu icon properties] --> {% assign nav_menu_icon_family = nav_menu_options.icon_family %} {% assign nav_menu_icon_style = nav_menu_options.icon_style %} {% assign nav_menu_icon_color = nav_menu_options.icon_color %} {% assign nav_menu_icon_size = nav_menu_options.icon_size %} {% assign icon_family = nav_menu_icon_family | strip | downcase %} {% if icon_family == 'fontawesome' or icon_family == 'fontawesome5' %} {% assign nav_menu_icon_family = 'fa' %} {% assign nav_menu_icon_style = nav_menu_icon_style %} {% elsif icon_family == 'mdi' %} {% assign nav_menu_icon_family = 'mdi' %} {% assign nav_menu_icon_style = nav_menu_icon_style %} {% else %} {% assign nav_menu_icon_family = 'mdi' %} {% assign nav_menu_icon_style = nav_menu_icon_style %} {% endif %} {% include {{select_color}} color=nav_menu_icon_color fallback="#9E9E9E" %} {% assign nav_menu_icon_color = color %} {% include {{select_icon_size}} family=nav_menu_icon_family size=nav_menu_icon_size %} {% assign nav_menu_icon_size = size %}
{% comment %} Main ——————————————————————————– {% endcomment %}
<!– [DEBUG ] [j1.modules.navigator.menu.html ] [collect all nav links for the navigation bar (navbar)] –> <div id=“{{menu_id}}” class=“{{dropdown_collapse}}” >
{% if nav_menu_animation %} <ul class="nav navbar-nav navigator navbar-{{nav_bar_position}}" data-in="{{animate_in}}" data-out="{{animate_out}}"> {% else %} <ul class="nav navbar-nav navigator navbar-{{nav_bar_position}}" data-in="fadeIn" data-out="fadeOut"> {% endif %} {% for menu in navigator_menu_config %} {% comment %} Identify the menu (item) type ---------------------------------------------------------------------------- {% endcomment %} {% if menu.sublevel %} {% assign menu_type = 'sublevel_menu' %} {% elsif menu.megamenu %} {% assign menu_type = 'mega_menu' %} {% elsif menu.auth_client %} {% assign menu_type = 'auth_client' %} {% elsif menu.theme_select %} {% assign menu_type = 'theme_select' %} {% elsif menu.sublevel == null and menu.megamenu == null and menu.login_menu == null and menu.theme_select == null %} {% assign menu_type = 'top_level_item' %} {% endif %} {% comment %} Process all menu sections ---------------------------------------------------------------------------- {% endcomment %} {% case menu_type %} {% comment %} Collect items having a SUB menue ---------------------------------------------------------------------------- {% endcomment %} {% when 'sublevel_menu' %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [found menu-type: sub-menue] --> <!-- [INFO ] [j1.modules.navigator.menu.html ] [submenu level 1 detected] --> <li class="dropdown nav-item"> {% if menu.icon == null %} <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" data-hover="dropdown">{{ menu.item }}</a> {% else %} <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" data-hover="dropdown"> <i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{menu.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i>{{ menu.item }}</a> {% endif %} <!-- jadams, 2017-11-24: (3) ul class="dropdown-menu {{nav_menu_position}} raised-z{{raised_level}}" style="opacity: 1; display: none;" --> <ul class="dropdown-menu {{nav_menu_position}} raised-z{{raised_level}}" style="display: none;"> {% for level_1 in menu.sublevel %} {% if level_1.dropdown == null %} {% if level_1.icon == null %} {% if level_1.target == null %} <li class="dropdown-item"><a href="{{ level_1.href }}{{ext}}">{{ level_1.title }}</a></li> {% else %} <li class="dropdown-item"><a href="{{ level_1.href }}{{ext}}" target="{{ level_1.target }}">{{ level_1.title }}</a></li> {% endif %} {% else %} {% if level_1.target == null %} <li class="dropdown-item"><a href="{{ level_1.href }}{{ext}}"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{level_1.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{ level_1.title }}</a></li> {% else %} <li class="dropdown-item"><a href="{{ level_1.href }}{{ext}}" target="{{ level_1.target }}"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{level_1.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{ level_1.title }}</a></li> {% endif %} {% endif %} {% endif %} {% if level_1.divider %} <li class="divider"></li> {% endif %} {% if level_1.dropdown %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [submenu level 2 (dropdown) detected] --> <li class="dropdown nav-item nav-sub-item"> {% if level_1.icon == null %} <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ level_1.title }}</a> {% else %} <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{level_1.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{ level_1.title }}</a> {% endif %} <!-- jadams, 2017-11-24: (4) ul class="dropdown-menu {{nav_menu_position}} raised-z{{raised_level}}" style="opacity: 1;" --> <ul class="dropdown-menu {{nav_menu_position}} raised-z{{raised_level}}"> {% for level_2 in level_1.dropdown %} {% if level_2.dropdown == null %} {% if level_2.icon == null %} {% if level_2.target == null %} <li class="dropdown-item"><a href="{{ level_2.href }}{{ext}}">{{ level_2.title }}</a></li> {% else %} <li class="dropdown-item"><a href="{{ level_2.href }}{{ext}}" target="{{ level_2.target }}">{{ level_2.title }}</a></li> {% endif %} {% else %} {% if level_2.target == null %} <li class="dropdown-item"><a href="{{ level_2.href }}{{ext}}"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{level_2.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{ level_2.title }}</a></li> {% else %} <li class="dropdown-item"><a href="{{ level_2.href }}{{ext}}" target="{{ level_2.target }}"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{level_2.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{ level_2.title }}</a></li> {% endif %} {% endif %} {% endif %} {% if level_2.divider %} <li class="divider"></li> {% endif %} {% if level_2.dropdown %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [submenu level 3 detected (last level supported)] --> <li class="dropdown nav-item nav-sub-item"> {% if level_2.icon == null %} <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{ level_2.title }}</a> {% else %} <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{level_2.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{ level_2.title }}</a> {% endif %} <!-- jadams, 2017-11-24: (5) ul class="dropdown-menu {{nav_menu_position}} raised-z{{raised_level}}" style="opacity: 1;" --> <ul class="dropdown-menu {{nav_menu_position}} raised-z{{raised_level}}"> {% for level_3 in level_2.dropdown %} {% if level_2.icon == null %} {% if level_3.target == null %} <li class="dropdown-item"><a href="{{ level_3.href }}{{ext}}">{{ level_3.title }}</a></li> {% else %} <li class="dropdown-item"><a href="{{ level_3.href }}{{ext}}" target="{{ level_3.target }}">{{ level_3.title }}</a></li> {% endif %} {% else %} {% if level_3.target == null %} <li class="dropdown-item"><a href="{{ level_3.href }}{{ext}}"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{level_3.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{ level_3.title }}</a></li> {% else %} <li class="dropdown-item"><a href="{{ level_3.href }}{{ext}}" target="{{ level_3.target }}"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{level_3.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{ level_3.title }}</a></li> {% endif %} {% endif %} {% if level_3.divider %} <li class="divider"></li> {% endif %} {% endfor %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [end processing: level 3] --> </ul> </li> {% endif %} {% endfor %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [end processing: level 2] --> </ul> </li> {% endif %} {% endfor %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [end processing: level 1] --> </ul> </li> <!-- [INFO ] [j1.modules.navigator.menu.html ] [reset menu_type for next loop] --> {% assign menu_type = '' %} {% comment %} Collect items having a MEGA menu ---------------------------------------------------------------------------- {% endcomment %} {% when 'mega_menu' %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [found menu-type: megamenu-menue] --> <!-- calculate size of mm_columns --> {% assign columns = menu.megamenu | size %} {% assign columns_width_md = 12 | divided_by:columns %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [Calculated size of mm_columns: {{ columns_width_md }}] --> <li class="dropdown nav-item megamenu-fw"> <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">{{menu.item}} </a> <ul class="dropdown-menu megamenu-content raised-z{{raised_level}}" style="max-height: {{nav_menu_options.max_height}}px; overflow-x: hidden; overflow-y: auto;" role="menu"> <li> <div class="row"> {% for megabox in menu.megamenu %} <div class="col-menu col-md-{{columns_width_md}} col-sm-6"> {% if megabox.icon == null %} <div class="post-headline mt-2 mb-3"> <h2 class="title" style="font-size:1.25em !important">{{megabox.title}}</h2> </div> {% else %} <div class="post-headline mt-2 mb-3"> <h2 class="title" style="font-size:1.25em !important"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{megabox.icon}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{megabox.title}}</h2> </div> {% endif %} <div class="content"> <ul class="menu-col"> {% for links in megabox.column %} {% if links.icon == null %} <li class="dropdown-megamenu-item"><a href="{{links.href}}{{ext}}" target="{{ links.target }}">{{links.title}}</a></li> {% else %} <li class="dropdown-megamenu-item"><a href="{{links.href}}{{ext}}" target="{{ links.target }}"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{links.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{links.title}}</a></li> {% endif %} {% endfor %} </ul> </div> </div> <!-- [INFO ] [j1.modules.navigator.menu.html ] [megamenu-menue: end megabox] --> {% endfor %} </div> </li> </ul> </li> <!-- [INFO ] [j1.modules.navigator.menu.html ] [megamenu-menue: end mega-menu] --> <!-- [INFO ] [j1.modules.navigator.menu.html ] [reset menu_type for next loop] --> {% assign menu_type = '' %} {% comment %}Collect TOP-LEVEL items (NO sub-menu) -------------------------------------------------------------------------- {% endcomment %} {% when 'top_level_item' %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [found menu-type: menu-top-level-only] --> {% if menu.icon == null %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [no icon for menu-item found --> {% if menu.target == null %} <li class="nav-item"> <a class="nav-link" href="{{ menu.href }}{{ext}}">{{ menu.item }}</a> </li> {% else %} <li class="nav-item"> <a class="nav-link" href="{{ menu.href }}{{ext}}" target="{{ menu.target }}">{{ menu.item }}</a> </li> {% endif %} {% elsif menu.icon %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [no icon for menu-item found --> {% if menu.target == null %} <li> <a class="nav-link" href="{{ menu.href }}{{ext}}"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{menu.icon}} {{nav_menu_icon_size}}" style="color:{{nav_menu_icon_color}}"></i> {{ menu.item }}</a> </li> {% else %} <li> <a class="nav-link" href="{{ menu.href }}{{ext}}" target="{{ menu.target }}"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{menu.icon}} {{nav_menu_icon_size}}" style="color:{{nav_menu_icon_color}}"></i> {{ menu.item }}</a> </li> {% endif %} {% else %} <!-- [FATAL ] [nav_menu.menu-top-level-only ] [processing menu item failed] --> {% endif %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [menu-top-level-only: end menu] --> <!-- [INFO ] [j1.modules.navigator.menu.html ] [reset menu_type for next loop] --> {% assign menu_type = '' %} {% comment %} Collect items having a LOGIN menu ------------------------------------------------------------------------ {% endcomment %} {% when 'auth_client' %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [found menu-type: auth_client] --> <li id="menuBarSignInOut" class="dropdown nav-item"> <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" data-hover="dropdown">{{menu.item}} </a> {% if nav_menu_animation %} <!-- jadams, 2017-11-24: (1) ul class="dropdown-menu {{nav_menu_position}} raised-z{{raised_level}}" style="opacity: 1; display: none;" --> <ul class="dropdown-menu {{nav_menu_position}} raised-z{{raised_level}}" style="display: none;"> <!-- ul class="dropdown-menu data-in="{{nav_menu_animation}}" data-out="{{nav_menu_animation}}" --> {% else %} <!-- jadams, 2017-11-24: (2) ul class="dropdown-menu {{nav_menu_position}} raised-z{{raised_level}}" style="opacity: 1; display: none;" --> <ul class="dropdown-menu {{nav_menu_position}} raised-z{{raised_level}}" style="display: none;"> {% endif %} {% assign item_found = 'false' %} {% for item in menu.auth_client %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [START: check signin] --> {% if item.mode == 'signin' %} <li class="dropdown-item"> <a href="#" data-toggle="modal" data-target="#modalOmniSignIn"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{item.icon}} {{nav_menu_icon_size}}" style="color:{{nav_menu_icon_color}}"></i>{{item.title}}</a> </li> {% assign item_found = 'true' %} {% endif %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [END: check signin] --> <!-- [INFO ] [j1.modules.navigator.menu.html ] [START: check signout] --> {% if item.mode == 'signout' %} <li class="dropdown-item"> <a href="#" data-toggle="modal" data-target="#modalOmniSignOut"><i class="{{nav_menu_icon_style}} {{nav_menu_icon_family}}-{{item.icon}} {{nav_menu_icon_size}}" style="color:{{nav_menu_icon_color}}"></i>{{item.title}}</a> </li> {% assign item_found = 'true' %} {% endif %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [END: check signout] --> {% if item_found == 'false' %} <!-- [FATAL ] [j1.modules.navigator.menu.html ] [no valid menu item config found] --> <li class="dropdown-item"> {% if item.title %} <a href="#" >Invalid: {{item.title}}</a> {% else %} <a href="#" >Item invalid</a> {% endif %} </li> {% endif %} {% endfor %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [login_menu: end menu] --> </ul> </li> <!-- [INFO ] [j1.modules.navigator.menu.html ] [reset menu_type for next loop] --> {% assign menu_type = '' %} {% comment %} Collect items having a THEMES menu ---------------------------------------------------------------------- {% endcomment %} {% when 'theme_select' %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [found menu-type: theme_select] --> <li class="dropdown nav-item"> <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" data-hover="dropdown">{{menu.item}} </a> {% if nav_menu_animation %} <ul class="dropdown-menu raised-z{{raised_level}}"> <!-- ul class="dropdown-menu data-in="{{nav_menu_animation}}" data-out="{{nav_menu_animation}}" --> {% else %} <ul class="dropdown-menu raised-z{{raised_level}}"> {% endif %} {% assign item_found = 'false' %} {% for item in menu.theme_select %} <!-- check for J1 Theme selector --> {% if item.local_themes and item.local_themes == 'enabled' %} <li class="dropdown nav-item nav-sub-item"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown"><i class="dropdown {{nav_menu_icon_family}} {{nav_menu_icon_family}}-{{item.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{item.title}}</a> <ul class="dropdown-menu raised-z{{raised_level}}" id="ThemeSelect"> </ul> </li> {% assign item_found = 'true' %} {% endif %} <!-- end J1 theme selector --> <!-- check for BootSwatch theme selector --> {% if item.bootswatch_themes and item.bootswatch_themes == 'enabled' %} <li class="dropdown nav-item nav-sub-item"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown"><i class="dropdown {{nav_menu_icon_family}} {{nav_menu_icon_family}}-{{item.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{item.title}}</a> <ul class="dropdown-menu raised-z{{raised_level}}" id="ThemeList"> </ul> </li> {% assign item_found = 'true' %} {% endif %} <!-- end BootSwatch theme selector --> {% if item.preview and item.preview == 'enabled' %} <li class="dropdown-item"> <a href="{{ theme_preview }}" ><i class="dropdown {{nav_menu_icon_family}} {{nav_menu_icon_family}}-{{item.icon}} {{nav_menu_icon_size}} mr-2" style="color:{{nav_menu_icon_color}}"></i> {{item.title}}</a> </li> {% assign item_found = 'true' %} {% endif %} <!-- end theme preview --> <!-- fallback if no valid config found --> {% if item_found == 'false' %} <li> {% if item.title %} <a href="#" >Invalid: {{item.title}}</a> {% else %} <a href="#" >Item invalid</a> {% endif %} </li> {% endif %} <!-- end fallback --> {% endfor %} </ul> </li> <!-- [INFO ] [j1.modules.navigator.menu.html ] [reset menu_type for next loop] --> {% assign menu_type = '' %} {% comment %} Collect items failed ---------------------------------------------------------------------- {% endcomment %} {% else %} <!-- [FATAL ] [j1.modules.navigator.menu.html ] [detecting menu items|type failed] --> {% assign menu_type = '' %} {% endcase %} {% endfor %} <!-- [INFO ] [j1.modules.navigator.menu.html ] [nav_menu_config: end menu] --> </ul> <!-- [INFO ] [j1.modules.navigator.menu.html ] [nav_menu_config: end navbar] -->
</div> <!– [INFO ] [j1.modules.navigator.menu.html ] [nav_menu_config: end processing] –>
{% endcapture %}
{{ cache | strip_empty_lines }} {% assign cache = nil %}