themes.html.twig 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. {% extends 'partials/base.html.twig' %}
  2. {% if admin.route %}
  3. {% set installing = admin.route starts with 'install' %}
  4. {% if installing %}
  5. {% set title = "PLUGIN_ADMIN.THEMES"|tu %}
  6. {% else %}
  7. {% set installed = true %}
  8. {# Try installed packages first, then remote #}
  9. {% set package = admin.themes(true)[admin.route] %}
  10. {% if (not package) %}
  11. {% set package = admin.themes(false)[admin.route] %}
  12. {% set installed = false %}
  13. {% endif %}
  14. {% set theme = package.toArray() %}
  15. {% set title = "PLUGIN_ADMIN.THEME"|tu ~ ": " ~ theme.name|e %}
  16. {% endif %}
  17. {% else %}
  18. {% set title = "PLUGIN_ADMIN.THEMES"|tu %}
  19. {% endif %}
  20. {% if admin.route or installing %}
  21. {% block stylesheets %}
  22. {% do assets.addCss(theme_url~'/css/codemirror/codemirror.css') %}
  23. {{ parent() }}
  24. {% endblock %}
  25. {% block javascripts %}
  26. {{ parent() }}
  27. {% endblock %}
  28. {% endif %}
  29. {% block titlebar %}
  30. {% if not admin.route or installing %}
  31. <div class="button-bar">
  32. {% if (installing) %}
  33. <a class="button" href="{{ base_url_relative }}/themes"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
  34. {% else %}
  35. <a class="button" href="{{ base_url }}/"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
  36. <a class="button" href="{{ base_url_relative }}/themes/install"><i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.ADD"|tu }}</a>
  37. {% if authorize(['admin.maintenance', 'admin.super']) %}
  38. <button data-gpm-checkupdates="" class="button"><i class="fa fa-refresh"></i> {{ "PLUGIN_ADMIN.CHECK_FOR_UPDATES"|tu }}</button>
  39. {% endif %}
  40. {% endif %}
  41. </div>
  42. <h1><i class="fa fa-fw fa-tint"></i> {{ "PLUGIN_ADMIN.THEMES"|tu }}</h1>
  43. {% else %}
  44. {% if (installed) %}
  45. <div class="button-bar">
  46. <a class="button" href="{{ base_url_relative }}/themes"><i class="fa fa-arrow-left"></i> {{ "PLUGIN_ADMIN.BACK_TO_THEMES"|tu }}</a>
  47. <button class="button" type="submit" name="task" value="save" form="blueprints"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|tu }}</button>
  48. </div>
  49. {% else %}
  50. <div class="button-bar">
  51. <a class="button" href="{{ base_url_relative }}/themes/install"><i class="fa fa-arrow-left"></i> {{ "PLUGIN_ADMIN.BACK_TO_THEMES"|tu }}</a>
  52. </div>
  53. {% endif %}
  54. <h1><i class="fa fa-fw fa-tint"></i> {{ "PLUGIN_ADMIN.THEME"|tu }}: {{ theme.name|e }}</h1>
  55. {% endif %}
  56. {% endblock %}
  57. {% block messages %}
  58. {{ parent() }}
  59. {% if config.plugins.admin.notifications.themes %}
  60. <div class="themes-notifications-container hidden"></div>
  61. {% endif %}
  62. {% endblock %}
  63. {% block content %}
  64. <div class="gpm gpm-themes">
  65. {% if not admin.route or installing %}
  66. {% include 'partials/themes-list.html.twig' %}
  67. {% else %}
  68. {% if theme is null %}
  69. {{redirect_me(base_url_relative ~ '/404')}}
  70. {% endif %}
  71. {% include 'partials/themes-details.html.twig' %}
  72. {% endif %}
  73. </div>
  74. {% endblock %}