themes.html.twig 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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"|t %}
  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 state = config.get('system.pages.theme') == theme.slug ? 'active' : 'inactive' %}
  16. {% set title = "PLUGIN_ADMIN.THEME"|t ~ ": " ~ theme.name %}
  17. {% endif %}
  18. {% else %}
  19. {% set title = "PLUGIN_ADMIN.THEMES"|t %}
  20. {% endif %}
  21. {% if admin.route or installing %}
  22. {% block stylesheets %}
  23. {% do assets.addCss(theme_url~'/css/codemirror/codemirror.css') %}
  24. {{ parent() }}
  25. {% endblock %}
  26. {% block javascripts %}
  27. {{ parent() }}
  28. {% endblock %}
  29. {% endif %}
  30. {% block titlebar %}
  31. {% if not admin.route or installing %}
  32. <div class="button-bar">
  33. {% if (installing) %}
  34. <a class="button" href="{{ admin_route('/themes') }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|t }}</a>
  35. {% else %}
  36. <a class="button" href="{{ admin_route('/') }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|t }}</a>
  37. <a class="button" href="{{ admin_route('/themes/install') }}"><i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.ADD"|t }}</a>
  38. {% if authorize(['admin.maintenance', 'admin.super']) %}
  39. <button data-gpm-checkupdates="" class="button"><i class="fa fa-refresh"></i> {{ "PLUGIN_ADMIN.CHECK_FOR_UPDATES"|t }}</button>
  40. {% endif %}
  41. {% endif %}
  42. </div>
  43. <h1><i class="fa fa-fw fa-tint"></i> {{ "PLUGIN_ADMIN.THEMES"|t }}</h1>
  44. {% else %}
  45. {% if (installed) %}
  46. <div class="button-bar">
  47. <a class="button" href="{{ admin_route('/themes') }}"><i class="fa fa-arrow-left"></i> {{ "PLUGIN_ADMIN.BACK_TO_THEMES"|t }}</a>
  48. {% if state == 'active' %}
  49. <button class="button" type="submit" name="task" value="save" form="blueprints"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|t }}</button>
  50. {% endif %}
  51. </div>
  52. {% else %}
  53. <div class="button-bar">
  54. <a class="button" href="{{ admin_route('/themes/install') }}"><i class="fa fa-arrow-left"></i> {{ "PLUGIN_ADMIN.BACK_TO_THEMES"|t }}</a>
  55. </div>
  56. {% endif %}
  57. <h1><i class="fa fa-fw fa-tint"></i> {{ "PLUGIN_ADMIN.THEME"|t }}: {{ theme.name }}</h1>
  58. {% endif %}
  59. {% endblock %}
  60. {% block messages %}
  61. {{ parent() }}
  62. {% if config.plugins.admin.notifications.themes %}
  63. <div class="themes-notifications-container hidden"></div>
  64. {% endif %}
  65. {% endblock %}
  66. {% block content %}
  67. <div class="gpm gpm-themes">
  68. {% if not admin.route or installing %}
  69. {% include 'partials/themes-list.html.twig' %}
  70. {% else %}
  71. {% if theme is null %}
  72. {{redirect_me(base_url_relative ~ '/404')}}
  73. {% endif %}
  74. {% include 'partials/themes-details.html.twig' %}
  75. {% endif %}
  76. </div>
  77. {% endblock %}