config.html.twig 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. {% extends 'partials/base.html.twig' %}
  2. {% set configurations = admin.configurations(true) %}
  3. {% set config_slug = admin.route %}
  4. {% if not config_slug %}
  5. {% set config_slug = configurations|first %}
  6. {% do admin.redirect('config/' ~ config_slug, 302) %}
  7. {% endif %}
  8. {% set isInfo = (config_slug == 'info') %}
  9. {% set tab_title_string = "PLUGIN_ADMIN." ~ config_slug|upper %}
  10. {% set tab_title = (tab_title_string|t == tab_title_string ? config_slug|capitalize : tab_title_string|t) ?: 'Not Found' %}
  11. {% set title = "PLUGIN_ADMIN.CONFIGURATION"|t ~ ": " ~ tab_title %}
  12. {% if config_slug and not isInfo %}
  13. {% set data = admin.data('config/' ~ config_slug) %}
  14. {% endif %}
  15. {% block stylesheets %}
  16. {% do assets.addCss(theme_url ~ '/css/codemirror/codemirror.css') %}
  17. {{ parent() }}
  18. {% endblock %}
  19. {% block javascripts %}
  20. {{ parent() }}
  21. {% endblock %}
  22. {% block titlebar %}
  23. <div class="button-bar">
  24. <a class="button" href="{{ admin_route('/') }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|t }}</a>
  25. {% if data.file.filename %}
  26. <button class="button" type="submit" name="task" value="save" form="blueprints"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|t }}</button>
  27. {% endif %}
  28. </div>
  29. <h1><i class="fa fa-fw fa-wrench"></i> {{ "PLUGIN_ADMIN.CONFIGURATION"|t }} - {{ tab_title }}</h1>
  30. {% endblock %}
  31. {% block content_top %}
  32. {% if authorize('admin.super') and data.file.filename %}
  33. <div class="alert notice">{{ "PLUGIN_ADMIN.SAVE_LOCATION"|t }}: <b>{{ data.file.filename|replace({(base_path):''}) }}</b></div>
  34. {% endif %}
  35. <div class="form-tabs">
  36. <div class="tabs-nav">
  37. {% for configuration in configurations %}
  38. <a {% if config_slug == configuration %}class="active"{% endif %} href="{{ admin_route('/config/' ~ configuration) }}">
  39. {% set configuration_string = "PLUGIN_ADMIN." ~ configuration|upper %}
  40. <span>{{ (configuration_string|t == configuration_string ? configuration|capitalize : configuration_string|t) }}</span>
  41. </a>
  42. {% endfor %}
  43. </div>
  44. </div>
  45. {% endblock %}
  46. {% block content %}
  47. {% set accessChangelog = authorize(['admin.maintenance', 'admin.super']) %}
  48. {% if config_slug in configurations %}
  49. {% if isInfo %}
  50. <div id="phpinfo">
  51. {% if accessChangelog %}
  52. <div style="margin-left:1.5rem">
  53. <a class="button button-big" href="#" style="text-align: center;" data-remodal-target="changelog" data-remodal-changelog="{{ admin_route('/changelog/type:plugins/slug:' ~ plugin.slug) }}"><i class="fa fa-binoculars"></i> View Grav Changelog</a>
  54. </div>
  55. {% endif %}
  56. {{ admin.phpinfo|raw }}
  57. </div>
  58. {% else %}
  59. <div class="config-wrapper-{{ config_slug }}">
  60. {% include 'partials/blueprints.html.twig' with { blueprints: data.blueprints, data: data } %}
  61. </div>
  62. {% endif %}
  63. {% include 'partials/modal-changes-detected.html.twig' %}
  64. {% if accessChangelog %}
  65. {% include 'partials/modal-changelog.html.twig' %}
  66. {% endif %}
  67. {% else %}
  68. {% do page.modifyHeader('http_response_code', 404) %}
  69. <div class="config-wrapper">
  70. <h2>Not found</h2>
  71. </div>
  72. {% endif %}
  73. {% endblock %}