nav.html.twig 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {% set nav_hover = config.plugins.admin.sidebar.activate == 'hover' %}
  2. {% if authorize(['admin.login', 'admin.super']) %}
  3. <nav id="admin-sidebar" data-quickopen="{{ config.plugins.admin.sidebar.activate == 'hover' ? 'true' : 'false' }}" data-quickopen-delay="{{ config.plugins.admin.sidebar.hover_delay }}">
  4. <div id="admin-logo" class="{{ nav_hover ? 'nav-hover' }}">
  5. {% if not nav_hover %}
  6. <div id="open-handle" data-sidebar-toggle><i class="fa fa-angle-right"></i></div>
  7. {% endif %}
  8. {% include 'partials/logo.html.twig' %}
  9. </div>
  10. {% include 'partials/nav-user-details.html.twig' %}
  11. {% include 'partials/nav-quick-tray.html.twig' %}
  12. <div class="admin-menu-wrapper">
  13. <ul id="admin-menu">
  14. <li class="{{ (location == 'dashboard') ? 'selected' : '' }}">
  15. <a href="{{ base_url_relative }}"><i class="fa fa-fw fa-th"></i><em>{{ "PLUGIN_ADMIN.DASHBOARD"|tu }}</em></a>
  16. </li>
  17. {% if authorize(['admin.configuration', 'admin.super']) %}
  18. <li class="{{ (location == 'system' or location == 'site' or location == 'config') ? 'selected' : '' }}">
  19. <a href="{{ base_url_relative }}/config/{{ authorize(['admin.configuration_system']) ? 'system' : 'site' }}"><i class="fa fa-fw fa-wrench"></i><em>{{ "PLUGIN_ADMIN.CONFIGURATION"|tu }}</em></a>
  20. </li>
  21. {% endif %}
  22. {% if authorize(['admin.pages', 'admin.super']) %}
  23. <li class="{{ (location == 'pages') ? 'selected' : '' }}">
  24. <a href="{{ base_url_relative }}/pages">
  25. <i class="fa fa-fw fa-file-text-o"></i>
  26. <em>{{ "PLUGIN_ADMIN.PAGES"|tu }}</em>
  27. <span class="badges">
  28. <span class="badge count">{{ admin.pagesCount }}</span>
  29. </span>
  30. </a>
  31. </li>
  32. {% endif %}
  33. {% if grav.twig.plugins_hooked_nav %}
  34. {% for label, item in grav.twig.plugins_hooked_nav %}
  35. {% if authorize((item.authorize is defined and item.authorize is iterable) ? item.authorize : [item.authorize ?: ('admin.' ~ (item.location ?: item.route)), 'admin.super']) %}
  36. <li class="{{ (location == (item.location ?: item.route)) ? 'selected' : '' }}">
  37. <a href="{{ base_url_relative }}/{{ item.route ?: item.location }}">
  38. <i class="fa fa-fw {{ item.icon }}"></i>
  39. <em>{{ label|tu }}</em>
  40. {% if item.badge %}
  41. <span class="badges {% if item.badge.updates is defined %}with-updates{% endif %}">
  42. {% if item.badge.updates is defined %}<span class="badge updates">{{ item.badge.updates }}</span>{% endif %}
  43. <span class="badge count">{{ item.badge.count }}</span>
  44. </span>
  45. {% endif %}
  46. </a>
  47. </li>
  48. {% endif %}
  49. {% endfor %}
  50. {% endif %}
  51. {% if authorize(['admin.plugins', 'admin.super']) %}
  52. <li class="{{ (location == 'plugins') ? 'selected' : '' }}">
  53. <a href="{{ base_url_relative }}/plugins">
  54. <i class="fa fa-fw fa-plug"></i>
  55. <em>{{ "PLUGIN_ADMIN.PLUGINS"|tu }}</em>
  56. <span class="badges">
  57. <span class="badge updates"></span>
  58. <span class="badge count">{{ admin.plugins|length }}</span>
  59. </span>
  60. </a>
  61. </li>
  62. {% endif %}
  63. {% if authorize(['admin.themes', 'admin.super']) %}
  64. <li class="{{ (location == 'themes') ? 'selected' : '' }}">
  65. <a href="{{ base_url_relative }}/themes">
  66. <i class="fa fa-fw fa-tint"></i>
  67. <em>{{ "PLUGIN_ADMIN.THEMES"|tu }}</em>
  68. <span class="badges">
  69. <span class="badge updates"></span>
  70. <span class="badge count">{{ admin.themes|length }}</span>
  71. </span>
  72. </a>
  73. </li>
  74. {% endif %}
  75. {% if authorize(admin.toolsPermissions) %}
  76. <li class="{{ (location == 'tools') ? 'selected' : '' }}">
  77. <a href="{{ base_url_relative }}/tools">
  78. <i class="fa fa-fw fa-briefcase"></i>
  79. <em>{{ "PLUGIN_ADMIN.TOOLS"|tu }}</em>
  80. </a>
  81. </li>
  82. {% endif %}
  83. {% include 'partials/nav-pro.html.twig' ignore missing %}
  84. <li>
  85. <a href="{{ uri.addNonce(base_url_relative ~ '/task' ~ config.system.param_sep ~ 'logout', 'logout-form', 'logout-nonce') }}"><i class="fa fa-fw fa-sign-out"></i><em>{{ "PLUGIN_ADMIN.LOGOUT"|tu }}</em></a>
  86. </li>
  87. </ul>
  88. </div>
  89. </nav>
  90. {% endif %}