plugins.html.twig 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. <a class="button" href="{{ base_url_relative }}/plugins/install"><i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.ADD"|tu }}</a>
  49. {% include 'plugins/'~admin.route~'-buttons.html.twig' ignore missing %}
  50. <button class="button" type="submit" name="task" value="save" form="blueprints"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|tu }}</button>
  51. </div>
  52. {% else %}
  53. <div class="button-bar">
  54. <a class="button" href="{{ base_url_relative }}/plugins/install"><i class="fa fa-arrow-left"></i> {{ "PLUGIN_ADMIN.BACK_TO_PLUGINS"|tu }}</a>
  55. </div>
  56. {% endif %}
  57. <h1><i class="fa fa-fw fa-plug"></i> {{ "PLUGIN_ADMIN.PLUGIN"|tu }}: {{ plugin.name|e }}</h1>
  58. {% endif %}
  59. {% endblock %}
  60. {% block messages %}
  61. {{ parent() }}
  62. {% if config.plugins.admin.notifications.plugins %}
  63. <div class="plugins-notifications-container hidden"></div>
  64. {% endif %}
  65. {% endblock %}
  66. {% block content %}
  67. <div class="gpm gpm-plugins">
  68. {% if not admin.route or installing %}
  69. {% include 'partials/plugins-list.html.twig' %}
  70. {% else %}
  71. {% if plugin is null %}
  72. {{redirect_me(base_url_relative ~ '/404')}}
  73. {% endif %}
  74. {% include 'partials/plugins-details.html.twig' %}
  75. {% endif %}
  76. </div>
  77. {% endblock %}