config.html.twig 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {% extends 'partials/base.html.twig' %}
  2. {% set config_slug = uri.basename|e %}
  3. {% set isInfo = (config_slug == 'info') %}
  4. {% set tab_title_string = "PLUGIN_ADMIN." ~ config_slug|upper %}
  5. {% set tab_title = (tab_title_string|tu == tab_title_string ? config_slug|capitalize : tab_title_string|tu) %}
  6. {% set title = "PLUGIN_ADMIN.CONFIGURATION"|tu ~ ": " ~ tab_title %}
  7. {% if not isInfo %}
  8. {% set data = admin.data('config/' ~ config_slug) %}
  9. {% endif %}
  10. {% block stylesheets %}
  11. {% do assets.addCss(theme_url ~ '/css/codemirror/codemirror.css') %}
  12. {{ parent() }}
  13. {% endblock %}
  14. {% block javascripts %}
  15. {{ parent() }}
  16. {% endblock %}
  17. {% block titlebar %}
  18. <div class="button-bar">
  19. <a class="button" href="{{ base_url }}"><i class="fa fa-reply"></i> {{ "PLUGIN_ADMIN.BACK"|tu }}</a>
  20. {% if data.file.filename %}
  21. <button class="button" type="submit" name="task" value="save" form="blueprints"><i class="fa fa-check"></i> {{ "PLUGIN_ADMIN.SAVE"|tu }}</button>
  22. {% endif %}
  23. </div>
  24. <h1><i class="fa fa-fw fa-wrench"></i> {{ "PLUGIN_ADMIN.CONFIGURATION"|tu }} - {{ tab_title }}</h1>
  25. {% endblock %}
  26. {% block content_top %}
  27. {% if data.file.filename %}
  28. <div class="alert notice">{{ "PLUGIN_ADMIN.SAVE_LOCATION"|tu }}: <b>{{ data.file.filename|replace({(base_path):''}) }}</b></div>
  29. {% endif %}
  30. <div class="form-tabs">
  31. <div class="tabs-nav">
  32. {% if authorize(['admin.configuration_system', 'admin.super']) %}
  33. <a {% if config_slug == 'system' %}class="active"{% endif %} href="{{ base_url_relative }}/config/system">
  34. <span>{{ "PLUGIN_ADMIN.SYSTEM"|tu }}</span>
  35. </a>
  36. {% endif %}
  37. {% if authorize(['admin.configuration_site', 'admin.super']) %}
  38. <a {% if config_slug == 'site' %}class="active"{% endif %} href="{{ base_url_relative }}/config/site">
  39. <span>{{ "PLUGIN_ADMIN.SITE"|tu }}</span>
  40. </a>
  41. {% endif %}
  42. {% for configuration in admin.configurations %}
  43. {% if authorize(['admin.configuration_' ~ configuration, 'admin.super']) %}
  44. {% set current_blueprints = admin.data('config/' ~ configuration).blueprints.toArray() %}
  45. {% if configuration != 'system' and configuration != 'site' and not current_blueprints.form.hidden and (current_blueprints.form.fields is not empty or current_blueprints.form.field is not empty) %}
  46. <a {% if config_slug == configuration %}class="active"{% endif %} href="{{ base_url_relative }}/config/{{configuration}}">
  47. {% set configuration_string = "PLUGIN_ADMIN." ~ configuration|upper %}
  48. <span>{{ (configuration_string|tu == configuration_string ? configuration|capitalize : configuration_string|tu) }}</span>
  49. </a>
  50. {% endif %}
  51. {% endif %}
  52. {% endfor %}
  53. {% if authorize(['admin.configuration_info', 'admin.super']) %}
  54. <a {% if config_slug == 'info' %}class="active"{% endif %} href="{{ base_url_relative }}/config/info">
  55. <span>{{ "PLUGIN_ADMIN.INFO"|tu }}</span>
  56. </a>
  57. {% endif %}
  58. </div>
  59. </div>
  60. {% endblock %}
  61. {% block content %}
  62. {% if authorize(['admin.configuration_' ~ config_slug, 'admin.super']) %}
  63. {% if isInfo %}
  64. <div id="phpinfo">
  65. {{ admin.phpinfo|raw }}
  66. </div>
  67. {% else %}
  68. {% include 'partials/blueprints.html.twig' with { blueprints: data.blueprints, data: data } %}
  69. {% endif %}
  70. {% endif %}
  71. {% include 'partials/modal-changes-detected.html.twig' %}
  72. {% endblock %}