diff --git a/src/plainui/jinja2/plainui/components/nav.html.j2 b/src/plainui/jinja2/plainui/components/nav.html.j2 index 90acccb2597d93dd9ba9d0f4fcd9238fa8e52c42..65c610c069bbc2870d22418fea6557f06bbfff0d 100644 --- a/src/plainui/jinja2/plainui/components/nav.html.j2 +++ b/src/plainui/jinja2/plainui/components/nav.html.j2 @@ -65,166 +65,169 @@ {{ _("Manage Badges") }} {% if num_of_pending_badges %}<span class="hub-header__badge badge">{{ num_of_pending_badges }}</span>{% endif %} </a> - {% if report_info %} - <li> - <a href="{{ build_report_url(request, report_info=report_info) }}" - class="dropdown-item">{{ _("report this url") }}</a> - </li> - {% endif %} + </li> + {% if report_info %} <li> - <hr class="dropdown-divider"> - </li> - <li> - <form action="{{ url("plainui:logout") }}?next={{ request.path }}" - method="post"> - {{ csrf_input }} - <button class="dropdown-item" href="">{{ _("logout") }}</button> - </form> - </li> - {% else %} - <li> - <a class="dropdown-item" - href="{{ url("plainui:login") }}?next={{ request.path }}">Login</a> + <a href="{{ build_report_url(request, report_info=report_info) }}" + class="dropdown-item">{{ _("report this url") }}</a> </li> {% endif %} - </ul> - </div> - {% endmacro %} - {% macro createmenu() %} - {% if not archive_mode %} - <div class="dropdown"> - <button class="hub-top-nav__button dropdown-toggle me-2" - type="button" - data-bs-toggle="dropdown" - aria-expanded="false"> - <i class="bi bi-plus-circle hub-top-nav__button-icon"></i> - </button> - <ul class="dropdown-menu"> - <li> - <a class="dropdown-item{% if not conf.is_open %} disabled{% endif %}" - href="{{ hub_absolute('backoffice:assembly-create') }}"> - <i class="bi bi-people-fill"></i> - Assembly - </a> - </li> - <!--li> - <a class="dropdown-item" href="#" disabled> - <i class="bi bi-hammer"></i> - Projekt + <li> + <hr class="dropdown-divider"> + </li> + <li> + <form action="{{ url("plainui:logout") }}?next={{ request.path }}" + method="post"> + {{ csrf_input }} + <button class="dropdown-item" href="">{{ _("logout") }}</button> + </form> + </li> + {% else %} + <li> + <a class="dropdown-item" + href="{{ url("plainui:login") }}?next={{ request.path }}">Login</a> + </li> + {% endif %} + </ul> + </div> +{% endmacro %} + +{% macro createmenu() %} + {% if not archive_mode %} + <div class="dropdown"> + <button class="hub-top-nav__button dropdown-toggle me-2" + type="button" + data-bs-toggle="dropdown" + aria-expanded="false"> + <i class="bi bi-plus-circle hub-top-nav__button-icon"></i> + </button> + <ul class="dropdown-menu"> + <li> + <a class="dropdown-item{% if not conf.is_open %} disabled{% endif %}" + href="{{ hub_absolute('backoffice:assembly-create') }}"> + <i class="bi bi-people-fill"></i> + Assembly </a> - </li --> - <li> - <a class="dropdown-item {% if conf.has_ended %}disabled{% endif %}" - href="{{ hub_absolute('backoffice:sos-create') }}"> - <i class="bi bi-controller"></i> - Self-organised-session - </a> - </li> - </ul> - </div> - {% endif %} - {% endmacro %} + </li> + <li> + <a class="dropdown-item{% if conf.has_ended %}disabled{% endif %}" + href="{{ hub_absolute('backoffice:so-create-project') }}"> + <i class="bi bi-hammer"></i> + Self-organised-project + </a> + </li> + <li> + <a class="dropdown-item {% if conf.has_ended %}disabled{% endif %}" + href="{{ hub_absolute('backoffice:sos-create') }}"> + <i class="bi bi-controller"></i> + Self-organised-session + </a> + </li> + </ul> + </div> + {% endif %} +{% endmacro %} - {# +{# Top navbar incl. page title and mobile version. TODO this should eventually become "header". #} - {% macro top_nav(title, has_breadcrumbs=False) %} - <div class="hub-top-nav {% if has_breadcrumbs %}hub-top-nav--breadcrumbs{% endif %}"> - <h1 class="hub-head-page">{{ title }}</h1> - {% if not archive_mode %} - <form method="post" action="{{ url('plainui:search') }}" role="search"> - {{ csrf_input }} - <input class="form-control" - name="q" - type="text" - placeholder="{{ _('search') }}" - value="{%- if search_query is defined -%}{{ search_query }}{%- endif -%}"> - </form> - {% endif %} - <div class="hub-top-nav__buttons"> - {{ dms() }} - {{ createmenu() }} - {{ usermenu() }} - </div> +{% macro top_nav(title, has_breadcrumbs=False) %} + <div class="hub-top-nav {% if has_breadcrumbs %}hub-top-nav--breadcrumbs{% endif %}"> + <h1 class="hub-head-page">{{ title }}</h1> + {% if not archive_mode %} + <form method="post" action="{{ url('plainui:search') }}" role="search"> + {{ csrf_input }} + <input class="form-control" + name="q" + type="text" + placeholder="{{ _('search') }}" + value="{%- if search_query is defined -%}{{ search_query }}{%- endif -%}"> + </form> + {% endif %} + <div class="hub-top-nav__buttons"> + {{ dms() }} + {{ createmenu() }} + {{ usermenu() }} </div> + </div> - {% if conf and conf.global_notification %} - {% call alert.info(class="mb-4") %} - {{ conf.global_notification }} - {% endcall %} - {% endif %} - {{ mobile_navbar(title) }} - {% endmacro %} + {% if conf and conf.global_notification %} + {% call alert.info(class="mb-4") %} + {{ conf.global_notification }} + {% endcall %} + {% endif %} + {{ mobile_navbar(title) }} +{% endmacro %} - {# Side navigation #} - {% macro main_navbar() %} - <input id="hub-mobile-nav-toggle" type="checkbox" class="d-none"> - <div id="hub-main-navbar" class="hub-main-navbar"> - <div class="p-3 pt-md-4"> - <div class="hub-navbar-logo text-white mb-md-4"> - {{ logoMacro.logo(conf, base_url, conf.name + " logo", conf.name + " logo") }} - </div> +{# Side navigation #} +{% macro main_navbar() %} + <input id="hub-mobile-nav-toggle" type="checkbox" class="d-none"> + <div id="hub-main-navbar" class="hub-main-navbar"> + <div class="p-3 pt-md-4"> + <div class="hub-navbar-logo text-white mb-md-4"> + {{ logoMacro.logo(conf, base_url, conf.name + " logo", conf.name + " logo") }} </div> + </div> - <!-- Only show on mobile --> - <div class="d-md-none p-3"> - <div class="hub-navbar-buttons d-flex gap-3 mb-3"> - {{ dms() }} - {{ createmenu() }} - {{ usermenu() }} - </div> - - <form method="post" action="{{ url('plainui:search') }}" role="search"> - {{ csrf_input }} - <input class="form-control" - name="q" - type="text" - placeholder="{{ _('search') }}" - value="{%- if search_query is defined -%}{{ search_query }}{%- endif -%}"> - </form> + <!-- Only show on mobile --> + <div class="d-md-none p-3"> + <div class="hub-navbar-buttons d-flex gap-3 mb-3"> + {{ dms() }} + {{ createmenu() }} + {{ usermenu() }} </div> - <div class="hub-main-navbar-items overflow-y-auto"> - <div class="p-3 pt-0"> - {% for category in conf.get_navigation_tree() %} - <span class="hub-main-navbar__category">{{ category.label }}</span> + <form method="post" action="{{ url('plainui:search') }}" role="search"> + {{ csrf_input }} + <input class="form-control" + name="q" + type="text" + placeholder="{{ _('search') }}" + value="{%- if search_query is defined -%}{{ search_query }}{%- endif -%}"> + </form> + </div> + + <div class="hub-main-navbar-items overflow-y-auto"> + <div class="p-3 pt-0"> + {% for category in conf.get_navigation_tree() %} + <span class="hub-main-navbar__category">{{ category.label }}</span> - <ul class="hub-main-navbar__items"> - {% for item in category.children %}{{ menuitem(item) }}{% endfor %} - </ul> - {% endfor %} - </div> + <ul class="hub-main-navbar__items"> + {% for item in category.children %}{{ menuitem(item) }}{% endfor %} + </ul> + {% endfor %} </div> </div> - {% endmacro %} + </div> +{% endmacro %} - {% macro mobile_navbar(title) %} - {% set num_notifications = num_of_notifications(request) -%} - <div class="hub-mobile-navbar"> - <div class="d-flex align-items-center gap-3 text-white"> - <label for="hub-mobile-nav-toggle" - role="button" - class="p-2 cursor-pointer position-relative" - style="margin: -8px"> - <svg xmlns="http://www.w3.org/2000/svg" - width="32" - height="32" - fill="currentColor" - class="bi bi-list" - viewBox="0 0 16 16"> - <path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z" /> - </svg> - {% if num_notifications %} - <span class="hub-mobile-nav-badge badge rounded-pill bg-danger"> - {{ num_notifications }} - <span class="visually-hidden">unread messages</span> - </span> - {% endif %} - </label> - <div class="hub-mobile-nav-title">{{ title }}</div> - </div> +{% macro mobile_navbar(title) %} + {% set num_notifications = num_of_notifications(request) -%} + <div class="hub-mobile-navbar"> + <div class="d-flex align-items-center gap-3 text-white"> + <label for="hub-mobile-nav-toggle" + role="button" + class="p-2 cursor-pointer position-relative" + style="margin: -8px"> + <svg xmlns="http://www.w3.org/2000/svg" + width="32" + height="32" + fill="currentColor" + class="bi bi-list" + viewBox="0 0 16 16"> + <path fill-rule="evenodd" d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z" /> + </svg> + {% if num_notifications %} + <span class="hub-mobile-nav-badge badge rounded-pill bg-danger"> + {{ num_notifications }} + <span class="visually-hidden">unread messages</span> + </span> + {% endif %} + </label> + <div class="hub-mobile-nav-title">{{ title }}</div> </div> - {% endmacro %} + </div> +{% endmacro %}