plugins.html.twig 3.6 KB

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