Edit the admin file input to handle showing uploaded files, showing previews, allow deleting if it's a plugin config

This commit is contained in:
Flavio Copes
2015-12-18 17:20:57 +01:00
parent 4247d6b20d
commit 7d9ce1a138

View File

@@ -3,8 +3,21 @@
{% set files = defaults.files|merge(field|default([])) %}
{% block input %}
{% if files.showuploaded == true %}
{{ value|replace({(files.destination ~ '/'): ''}) }}
{% if value %}
{% if files.showuploaded == true %}
{% if files.showuploadedpreview %}
<img src="{{ base_url_relative_frontend == '/' ? '/' : base_url_relative_frontend ~ '/'}}{{ value }}" />
{% else %}
{{ value|replace({(files.destination ~ '/'): ''}) }}
{% endif %}
{% if files.ispluginconfig %}
<a href="{{ uri.addNonce('/admin/media/' ~ base64_encode(base_path ~ '/' ~ value) ~ '/task' ~ config.system.param_sep ~ 'removeFileFromPluginConfig' ~ '/plugin_name' ~ config.system.param_sep ~ files.pluginname ~ '/field_name' ~ config.system.param_sep ~ files.name ~ '/redirect' ~ config.system.param_sep ~ base64_encode(uri.path), 'admin-form', 'admin-nonce') }}">
<i class="fa fa-close"></i>
</a>
{% endif %}
{% endif %}
{% endif %}
<div class="form-input-wrapper {{ field.size }}">