plugins-list.html.twig 4.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. {% set gumroad_loaded = false %}
  2. <div class="grav-update plugins"></div>
  3. {% if installing %}
  4. {% include 'partials/release-toggle.html.twig' %}
  5. {% endif %}
  6. {% include 'partials/list-sort.html.twig' with { list_view: 'plugins' } %}
  7. <h1>
  8. {{ installing ? "PLUGIN_ADMIN.AVAILABLE_PLUGINS"|tu : "PLUGIN_ADMIN.INSTALLED_PLUGINS"|tu }}
  9. </h1>
  10. <form>
  11. <div class="gpm-search">
  12. <input type="text" placeholder="{{ "PLUGIN_ADMIN.RESOURCE_FILTER"|tu }}" data-gpm-filter>
  13. </div>
  14. </form>
  15. <table>
  16. {% for slug, plugin in admin.plugins(not installing).toArray|ksort %}
  17. {% set data = admin.data('plugins/' ~ slug) %}
  18. {% set isTestingRelease = admin.gpm.isTestingRelease(slug) %}
  19. {% set releaseDate = plugin.date ?: admin.gpm.findPackage(slug, true).date %}
  20. <tr data-gpm-plugin="{{ slug|url_encode }}" data-gpm-name="{{ plugin.name }}" data-gpm-release-date="{{ releaseDate }}" data-gpm-author="{{ plugin.author.name }}" data-gpm-official="{{ admin.isTeamGrav(plugin) ? '1' : '2' }}" data-gpm-updatable="{{ admin.gpm.isUpdatable(slug) ? '1' : '2' }}" data-gpm-enabled="{{ data.get('enabled') ? '1' : '2' }}" data-gpm-testing="{{ isTestingRelease ? '1' : '2' }}">
  21. <td class="gpm-name quadruple">
  22. <i class="fa fa-fw fa-{{ plugin.icon }}"></i>
  23. <a href="{{ base_url_relative }}/plugins/{{ slug|url_encode }}">{{ plugin.name }}</a>
  24. {% if admin.isTeamGrav(plugin) %}
  25. <small><span class="info-reverse"><i class="fa fa-check-circle" title="{{ "PLUGIN_ADMIN.GRAV_OFFICIAL_PLUGIN"|tu }}"></i></span></small>
  26. {% endif %}
  27. {% if admin.isPremiumProduct(plugin) %}
  28. {% if not gumroad_loaded %}
  29. {% set gumroad_loaded = true %}
  30. <script src="//gumroad.com/js/gumroad.js"></script>
  31. {% endif %}
  32. <small><span class="badge warning premium"><i class="fa fa-star-o"></i> {{ "PLUGIN_ADMIN.PREMIUM_PRODUCT"|tu }}</span></small>
  33. {% endif %}
  34. {% if plugin.symlink %}
  35. <span class="hint--bottom" data-hint="{{ "PLUGIN_ADMIN.PLUGIN_SYMBOLICALLY_LINKED"|tu }}">
  36. <i class="fa fa-fw fa-link"></i>
  37. </span>
  38. {% endif %}
  39. <span class="gpm-version">v{{ plugin.version }}</span>
  40. {% if isTestingRelease %}<span class="gpm-testing">test release</span>{% endif %}
  41. </td>
  42. <td class="gpm-actions">
  43. {% if (not installing and (plugin.form.fields.enabled.type != 'hidden' and plugin.form.fields.tabs.fields.options.fields.enabled.type != 'hidden')) %}
  44. <a class="{{ data.get('enabled') ? 'enabled' : 'disabled' }}" href="{{ uri.addNonce(base_url_relative ~ '/plugins/' ~ slug ~ '/task' ~ config.system.param_sep ~ (data.get('enabled') ? 'disable' : 'enable'), 'admin-form', 'admin-nonce') }}">
  45. <i class="fa fa-fw fa-toggle-{{ data.get('enabled') ? 'on' : 'off' }}"></i>
  46. </a>
  47. {% elseif (installing) %}
  48. {% if (plugin.premium and not admin.license(plugin.slug)) %}
  49. {% if not gumroad_loaded %}
  50. {% set gumroad_loaded = true %}
  51. <script src="//gumroad.com/js/gumroad.js"></script>
  52. {% endif %}
  53. <a class="gumroad-button button" href="https://gum.co/{{ plugin.premium.permalink }}" target="_blank" data-gumroad-single-product="true"><i class="fa fa-shopping-cart"></i> {{ "Buy Now"|tu }}</a>
  54. {% else %}
  55. <a class="button" href="#" data-remodal-target="add-package" data-packages-slugs="{{ plugin.slug }}" data-plugin-action="start-package-installation"><i class="fa fa-plus"></i> {{ "PLUGIN_ADMIN.INSTALL"|tu }}</a>
  56. {% endif %}
  57. {% endif %}
  58. <span class="gpm-details-expand"><i class="fa fa-chevron-down"></i></span>
  59. </td>
  60. <td class="gpm-details">
  61. <div class="table-wrapper">
  62. {% include 'partials/plugin-data.html.twig' with { plugin: plugin } %}
  63. </div>
  64. </td>
  65. </tr>
  66. {% else %}
  67. <tr><td>{{ "PLUGIN_ADMIN.OFFLINE_WARNING"|tu }}</td></tr>
  68. {% endfor %}
  69. </table>
  70. {% include 'partials/modal-add-package.html.twig' with { type: 'plugin' } %}
  71. {% include 'partials/modal-update-packages.html.twig' with { type: 'plugin' } %}