nav.html.twig 5.4 KB

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