From 5c1eb468577f4d3e4aa25aab190a5e4860a2a7d7 Mon Sep 17 00:00:00 2001 From: Yuriy Bakhtin Date: Fri, 20 Oct 2023 14:54:01 +0200 Subject: [PATCH] Allow deleting of uploaded file from template element --- docs/CHANGELOG.md | 1 + modules/template/models/FileContent.php | 5 +++++ modules/template/widgets/views/fileContentFormFields.php | 1 + 3 files changed, 7 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0e153106..db165bab 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,6 +7,7 @@ Changelog - Fix #291: Fix broken URL in email footer - Fix #293: Initialize module content class - Enh #301: Tests for `next` version +- Enh #318: Allow deleting of uploaded file from template element 1.9.3 (June 13, 2023) --------------------- diff --git a/modules/template/models/FileContent.php b/modules/template/models/FileContent.php index 00d4c28b..6e8aa876 100644 --- a/modules/template/models/FileContent.php +++ b/modules/template/models/FileContent.php @@ -115,4 +115,9 @@ public function renderForm($form) ]); } + public function canEdit($user = null): bool + { + return PagePermission::canEdit(); + } + } diff --git a/modules/template/widgets/views/fileContentFormFields.php b/modules/template/widgets/views/fileContentFormFields.php index 11fd3d8f..42921f97 100644 --- a/modules/template/widgets/views/fileContentFormFields.php +++ b/modules/template/widgets/views/fileContentFormFields.php @@ -32,6 +32,7 @@ 'id' => $id . '-preview', 'popoverPosition' => 'top', 'items' => [$model->getFile()], + 'edit' => true, 'options' => ['style' => 'display:block;margin-left:150px']]) ?> $id . '-progress', 'options' => ['style' => 'display:block;margin-left:150px;width:500px']]) ?>