plugins.html.twig 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. {% extends 'partials/base.html.twig' %}
  2. {% set plugin_slug = admin.route %}
  3. {% if plugin_slug %}
  4. {% set installing = plugin_slug starts with 'install' %}
  5. {% if installing %}
  6. {% set title = "PLUGIN_ADMIN.PLUGINS"|tu %}
  7. {% else %}
  8. {% set installed = true %}
  9. {# Try installed packages first, then remote #}
  10. {% set package = admin.plugins(true)[admin.route] %}
  11. {% if (not package) %}
  12. {% set package = admin.plugins(false)[admin.route] %}
  13. {% set installed = false %}
  14. {% endif %}
  15. {% set plugin = package.toArray() %}
  16. {% set title = "PLUGIN_ADMIN.PLUGIN"|tu ~ ": " ~ plugin.name|e %}
  17. {% endif %}
  18. {% else %}
  19. {% set title = "PLUGIN_ADMIN.PLUGINS"|tu %}
  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="{{ base_url_relative }}/plugins"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
  35. {% else %}
  36. <a class="button" href="{{ base_url }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
  37. <a class="button" href="{{ base_url_relative }}/plugins/install"><i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.ADD"|tu }}</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"|tu }}</button>
  40. {% endif %}
  41. {% endif %}
  42. </div>
  43. <h1><i class="fa fa-fw fa-plug"></i> {{ "PLUGIN_ADMIN.PLUGINS"|tu }}</h1>
  44. {% else %}
  45. {% if (installed) %}
  46. <div class="button-bar">
  47. <a class="button" href="{{ base_url_relative }}/plugins"><i class="fa fa-arrow-left"></i> {{ "PLUGIN_ADMIN.BACK_TO_PLUGINS"|tu }}</a>
  48. {% include 'plugins/'~admin.route~'-buttons.html.twig' ignore missing %}
  49. <button class="button" type="submit" name="task" value="save" form="blueprints"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|tu }}</button>
  50. </div>
  51. {% else %}
  52. <div class="button-bar">
  53. <a class="button" href="{{ base_url_relative }}/plugins/install"><i class="fa fa-arrow-left"></i> {{ "PLUGIN_ADMIN.BACK_TO_PLUGINS"|tu }}</a>
  54. </div>
  55. {% endif %}
  56. <h1><i class="fa fa-fw fa-plug"></i> {{ "PLUGIN_ADMIN.PLUGIN"|tu }}: {{ plugin.name|e }}</h1>
  57. {% endif %}
  58. {% endblock %}
  59. {% block messages %}
  60. {{ parent() }}
  61. {% if config.plugins.admin.notifications.plugins %}
  62. <div class="plugins-notifications-container hidden"></div>
  63. {% endif %}
  64. {% endblock %}
  65. {% block content %}
  66. <div class="gpm gpm-plugins">
  67. {% if not admin.route or installing %}
  68. {% include 'partials/plugins-list.html.twig' %}
  69. {% else %}
  70. {% if plugin is null %}
  71. {{redirect_me(base_url_relative ~ '/404')}}
  72. {% endif %}
  73. {% include 'partials/plugins-details.html.twig' %}
  74. {% endif %}
  75. </div>
  76. {% endblock %}