mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-07 01:27:14 +02:00
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:
@@ -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 }}">
|
||||
|
||||
Reference in New Issue
Block a user