112 lines
5.5 KiB
HTML
Executable File
112 lines
5.5 KiB
HTML
Executable File
{% macro menu() %}
|
|
{% if show_menu() %}
|
|
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark flex-md-nowrap shadow" role="navigation">
|
|
<a class="navbar-brand" href="/">{{get_web_title()}}</a>
|
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExample01" aria-controls="navbarsExample01" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
{% for i in range(2) %}
|
|
<div class="collapse navbar-collapse w-100" id="navbarsExample01">
|
|
{% if i == 0 %}
|
|
<ul class="nav navbar-nav mr-auto">
|
|
{% else %}
|
|
<ul class="nav navbar-nav ml-auto">
|
|
{% endif %}
|
|
{% set menu = request.full_path | get_menu %}
|
|
{% set menu_map = get_menu_map() %}
|
|
{% set login_status = get_login_status() %}
|
|
{% for category in menu_map %}
|
|
|
|
{% if category['type'] == 'link' and login_status == False %}
|
|
{% continue %}
|
|
{% endif %}
|
|
{% if (i==0 and category['position'] == 'left') or (i==1 and category['position'] == 'right') %}
|
|
<li class="nav-item dropdown">
|
|
{% if category['count'] == 0 %}
|
|
<a class="nav-link" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{category['category']}}</a>
|
|
{% else %}
|
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{category['category']}}</a>
|
|
{% endif %}
|
|
|
|
{% if not (category['type'] == 'custom' and category['count'] == 0) %}
|
|
{% if category['position'] == 'left' %}
|
|
<div class="dropdown-menu" style="top:34px;" aria-labelledby="navbarDropdown">
|
|
{% else %}
|
|
<div class="dropdown-menu dropdown-menu-right" style="top:34px;" aria-labelledby="navbarDropdown">
|
|
{% endif %}
|
|
{% for category_child in category['list'] %}
|
|
{% if category_child['type'] == 'link' %}
|
|
<a class="dropdown-item" href="{{ category_child['link'] }}" target="_blank" style="font-size: .850rem; font-weight:bold">{{ category_child['name'] }}</a>
|
|
{% elif category_child['type'] == 'direct' %}
|
|
<a class="dropdown-item" href="{{ category_child['link'] }}" style="font-size: .850rem; font-weight:bold">{{ category_child['name'] }}</a>
|
|
{% elif category_child['type'] == 'divider' %}
|
|
<div class="dropdown-divider"></div>
|
|
{% else %}
|
|
{% if 'exist' in category_child %}
|
|
{% if category_child['plugin'] == menu[0] %}
|
|
<a class="dropdown-item active" href="/{{ category_child['plugin'] }}" style="font-size: .850rem; font-weight:bold">{{ category_child['name'] }}</a>
|
|
{% else %}
|
|
<a class="dropdown-item" href="/{{ category_child['plugin'] }}" style="font-size: .850rem; font-weight:bold">{{ category_child['name'] }}</a>
|
|
{% endif %}
|
|
{% else %}
|
|
<a class="dropdown-item disabled" href="#" style="font-size: .850rem;color: gray">{{ category_child['name'] }}</a>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
</div>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endfor %}
|
|
</nav>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
{% macro left(endpoint) %}
|
|
<div id='plugin_first_menu'>
|
|
{% set menu = request.full_path | get_menu %}
|
|
{% set menu_map = get_menu_map() %}
|
|
{% for category in menu_map %}
|
|
{% for category_child in category['list'] %}
|
|
{% if menu[0] == category_child['plugin'] %}
|
|
<ul class="nav nav-pills bg-light shadow text-dark" >
|
|
<li class="nav-item"><span class="nav-link">{{category['category']}} >> {{category_child['name']}}</span></li>
|
|
{% for sub in category_child['sub'] %}
|
|
{% if menu[1] == sub[0] %}
|
|
<li class="nav-item"><a class="nav-link active" href="/{{menu[0]}}/{{sub[0]}}">{{sub[1]}}</a></li>
|
|
{% else %}
|
|
<li class="nav-item"><a class="nav-link" href="/{{menu[0]}}/{{sub[0]}}">{{sub[1]}}</a></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
{% break %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endfor %}
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
{% macro menu_sub() %}
|
|
{% set menu = request.full_path | get_menu %}
|
|
{% set plugin_menu = menu[0] | get_plugin_menu %}
|
|
{% if plugin_menu != None %}
|
|
{% if 'sub2' in plugin_menu and plugin_menu['sub2'] != None %}
|
|
{% if menu[1] in plugin_menu['sub2'] %}
|
|
<ul class="nav nav-pills bg-light shadow text-dark" >
|
|
{% for sub_menu in plugin_menu['sub2'][menu[1]] %}
|
|
{% if sub_menu[0] == menu[2] %}
|
|
<li class="nav-item"><a class="nav-link active" href="/{{ menu[0] }}/{{ menu[1] }}/{{ sub_menu[0] }}">{{sub_menu[1]}}</a></li>
|
|
{% else %}
|
|
<li class="nav-item"><a class="nav-link" href="/{{ menu[0] }}/{{ menu[1] }}/{{ sub_menu[0] }}">{{sub_menu[1]}}</a></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
<div class="d-inline-block"></div>
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endmacro %}
|