templates/menu.html.twig line 1

Open in your IDE?
  1. {% trans_default_domain "base" %}
  2. <div class="justify-content-center d-flex">
  3.     <div class="main-menu">
  4.         {% if app.user %}
  5.             <div class="title">
  6.                 {{ app.user.username }}
  7.             </div>
  8.             <p class="text-muted mb-3">
  9.                 ROLE_USER
  10.             </p>
  11.         {% endif %}
  12.         {% if menu|length > 1 %}
  13.             <ul class="nav nav-tabs" id="myTab" role="tablist">
  14.                 {% for projectName, projectMenu in menu %}
  15.                     <li class="nav-item">
  16.                         <a class="nav-link {% if projectName == activeProject %}active{% endif %}"
  17.                            id="{{ projectName }}-tab"
  18.                            data-toggle="tab"
  19.                            href="#{{ projectName }}"
  20.                            role="tab"
  21.                            aria-controls="{{ projectName }}"
  22.                            aria-selected="{% if projectName == activeProject %}true{% else %}false{% endif %}"
  23.                         >{{ projectName|trans }}</a>
  24.                     </li>
  25.                 {% endfor %}
  26.             </ul>
  27.         {% endif %}
  28.         <div class="tab-content" id="menuContent">
  29.             {% for projectName, projectMenu in menu %}
  30.                 <div class="tab-pane fade {% if projectName == activeProject %}active show{% endif%}"
  31.                      id="{{ projectName }}"
  32.                      role="tabpanel"
  33.                      aria-labelledby="{{ projectName }}-tab"
  34.                 >
  35.                     <ul class="list-unstyled text-left">
  36.                         {% for categoryName, reportsByCategory in projectMenu %}
  37.                             {% set showMenuCategory = reportsByCategory.granted is null %}
  38.                             {% for role in reportsByCategory.granted %}
  39.                                 {% if not showMenuCategory %}
  40.                                     {% set showMenuCategory = is_granted(role) %}
  41.                                 {% endif %}
  42.                             {% endfor %}
  43.                             {% if showMenuCategory %}
  44.                                 <li class="mt-2 text-center">
  45.                                     {{ categoryName|trans }}
  46.                                     <hr class="mt-0">
  47.                                 </li>
  48.                                 {% for reportPath, report in reportsByCategory.reports %}
  49.                                     {% set showMenuRow = report.granted is null %}
  50.                                     {% for role in report.granted %}
  51.                                         {% if not showMenuRow %}
  52.                                             {% set showMenuRow = is_granted(role) %}
  53.                                         {% endif %}
  54.                                     {% endfor %}
  55.                                     {% if showMenuRow %}
  56.                                         <li>
  57.                                             <a {{ currentRoute == reportPath ? 'class="active"' : '' }} href="{{ path(reportPath) }}">
  58.                                                 {{ report.name|trans }}
  59.                                             </a>
  60.                                         </li>
  61.                                     {% endif %}
  62.                                 {% endfor %}
  63.                             {% endif %}
  64.                         {% endfor %}
  65.                         <li class="mt-2 text-center">
  66.                             {{ 'system'|trans }}
  67.                             <hr class="mt-0">
  68.                         </li>
  69.                         {% if is_granted("ROLE_BI_APP_ROLES") or is_granted("ROLE_USER_EDIT") %}
  70.                             <li>
  71.                                 <a {{ currentRoute == 'app_roles' ? 'class="active"' : '' }} href="{{ path('app_roles') }}">{{ 'roles'|trans }}</a>
  72.                             </li>
  73.                             {% if is_granted("ROLE_USER_EDIT") %}
  74.                                 <li>
  75.                                     <a {{ currentRoute == 'app_role_groups' ? 'class="active"' : '' }} href="{{ path('app_role_groups') }}">{{ 'role_groups'|trans }}</a>
  76.                                 </li>
  77.                             {% endif %}
  78.                         {% endif %}
  79.                         <li>
  80.                             <a href="{{ path('app_logout') }}">{{ 'logout'|trans }}</a>
  81.                         </li>
  82.                     </ul>
  83.                 </div>
  84.             {% endfor %}
  85.             {% if not menu|length %}
  86.                 <ul class="list-unstyled text-left">
  87.                     <li>
  88.                         <a href="{{ path('app_logout') }}">{{ 'logout'|trans }}</a>
  89.                     </li>
  90.                 </ul>
  91.             {% endif %}
  92.         </div>
  93.     </div>
  94. </div>