From 616e916df4146e7aec64e9ec44802437a5e5ff66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20G=C3=BCnther?= Date: Wed, 15 Jan 2025 09:32:26 +0000 Subject: [PATCH 1/2] BUGFIX: Preventing the Rendering of UploadedResourcePreview Upon encountering a validation error during the upload process, the generation of the URL is hindered. Consequently, the rendering of the preview for invalid upload elements is suppressed. Fixes: #33 --- Resources/Private/Fusion/Elements/FileUpload.fusion | 1 + Resources/Private/Fusion/Elements/ImageUpload.fusion | 1 + 2 files changed, 2 insertions(+) diff --git a/Resources/Private/Fusion/Elements/FileUpload.fusion b/Resources/Private/Fusion/Elements/FileUpload.fusion index c1610ad..3d2d5fb 100644 --- a/Resources/Private/Fusion/Elements/FileUpload.fusion +++ b/Resources/Private/Fusion/Elements/FileUpload.fusion @@ -11,6 +11,7 @@ prototype(Neos.Form:FileUpload) < prototype(Neos.Form.FusionRenderer:FormElement } content = ${elementValue.fileName} @if.hasUploadedResource = ${elementValue ? true : false} + @if.hasNoValidationErrors = ${!elementHasValidationErrors} } uploadedResourceHiddenField = Neos.Fusion:Tag { @position = 'before field' diff --git a/Resources/Private/Fusion/Elements/ImageUpload.fusion b/Resources/Private/Fusion/Elements/ImageUpload.fusion index 8793134..ee332d0 100644 --- a/Resources/Private/Fusion/Elements/ImageUpload.fusion +++ b/Resources/Private/Fusion/Elements/ImageUpload.fusion @@ -14,6 +14,7 @@ prototype(Neos.Form:ImageUpload) < prototype(Neos.Form.FusionRenderer:FormElemen maximumWidth = 200 } @if.hasUploadedImage = ${elementValue ? true : false} + @if.hasNoValidationErrors = ${!elementHasValidationErrors} } uploadedImageHiddenField = Neos.Fusion:Tag { @position = 'before field' From 6bf4fc029a7fb7fc7a8d5b6e5b066cf5ee249882 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20G=C3=BCnther?= Date: Wed, 15 Jan 2025 10:23:11 +0000 Subject: [PATCH 2/2] TASK: Also use accept attribute for image uploads --- Resources/Private/Fusion/Elements/ImageUpload.fusion | 1 + 1 file changed, 1 insertion(+) diff --git a/Resources/Private/Fusion/Elements/ImageUpload.fusion b/Resources/Private/Fusion/Elements/ImageUpload.fusion index ee332d0..495414c 100644 --- a/Resources/Private/Fusion/Elements/ImageUpload.fusion +++ b/Resources/Private/Fusion/Elements/ImageUpload.fusion @@ -30,6 +30,7 @@ prototype(Neos.Form:ImageUpload) < prototype(Neos.Form.FusionRenderer:FormElemen tagName = 'input' attributes { type = 'file' + accept = ${Neos.Form.FusionRenderer.getAcceptFromAllowedExtensions(element.properties.allowedTypes)} name = ${elementName + '[resource]'} } }