-
-
- {neos:backend.translate(id: 'shortcut.toSpecificTarget', value: 'This is a shortcut to a specific target:')}
-
-
-
-
-
- Click to continue to the page.
-
-
-
- {targetConverted.label}'}">
- Click {targetConverted.label} to see the file.
-
-
-
- {target}'}">
- Click {target} to open the link.
-
-
-
-
- {neos:backend.translate(id: 'shortcut.noTargetSelected', value: '(no target has been selected)')}
-
-
-
-
- This is a shortcut to the first child page.
- Click to continue to the page.
-
-
-
-
- This is a shortcut to the parent page.
- Click to continue to the page.
-
-
-
-
-
From 9fb5ef02b7aa699f2249b133593c6e431137addb Mon Sep 17 00:00:00 2001
From: mhsdesign <85400359+mhsdesign@users.noreply.github.com>
Date: Wed, 2 Nov 2022 13:25:15 +0100
Subject: [PATCH 002/113] TASK Neos.Neos:Shortcut remove translation fallbacks
with https://github.com/neos/neos-development-collection/pull/3937 we dont need the fallbacks anymore ;)
---
.../Private/Fusion/Prototypes/Shortcut.fusion | 37 ++++---------------
1 file changed, 7 insertions(+), 30 deletions(-)
diff --git a/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion b/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
index 364753f33d8..603210b8f49 100644
--- a/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
+++ b/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
@@ -14,10 +14,7 @@ prototype(Neos.Neos:Shortcut) < prototype(Neos.Fusion:Component) {
selectedTarget = Neos.Fusion:Join {
@glue = ' '
- mainMessage = Neos.Fusion:Value {
- fallback = 'This is a shortcut to a specific target:'
- value = ${props.i18n.id('shortcut.toSpecificTarget').value(this.fallback).translate()}
- }
+ mainMessage = ${props.i18n.id('shortcut.toSpecificTarget').translate()}
targetMessage = Neos.Fusion:Case {
targetSelected {
condition = ${props.target}
@@ -28,10 +25,7 @@ prototype(Neos.Neos:Shortcut) < prototype(Neos.Fusion:Component) {
targetUriTag = Neos.Neos:NodeLink {
node = ${props.targetConverted}
}
- fallback = afx`
- Click {this.targetUriTag} to continue to the page.
- `
- value = ${props.i18n.id('shortcut.clickToContinueToPage').arguments([this.targetUriTag]).value(this.fallback).translate()}
+ value = ${props.i18n.id('shortcut.clickToContinueToPage').arguments([this.targetUriTag]).translate()}
}
asset = Neos.Fusion:Value {
@@ -41,30 +35,21 @@ prototype(Neos.Neos:Shortcut) < prototype(Neos.Fusion:Component) {
{props.targetConverted.label}
`
- fallback = afx`
- Click {this.targetUriTag} to see the file.
- `
- value = ${props.i18n.id('shortcut.clickToContinueToAsset').arguments([this.targetUriTag]).value(this.fallback).translate()}
+ value = ${props.i18n.id('shortcut.clickToContinueToAsset').arguments([this.targetUriTag]).translate()}
}
@default = Neos.Fusion:Value {
targetUriTag = afx`
{props.target}
`
- fallback = afx`
- Click {this.targetUriTag} to open the link.
- `
- value = ${props.i18n.id('shortcut.clickToContinueToExternalUrl').arguments([this.targetUriTag]).value(this.fallback).translate()}
+ value = ${props.i18n.id('shortcut.clickToContinueToExternalUrl').arguments([this.targetUriTag]).translate()}
}
}
}
noTargetSelected {
@position = 'end'
condition = true
- renderer = Neos.Fusion:Value {
- fallback = 'no target has been selected'
- value = ${props.i18n.id('shortcut.noTargetSelected').value(this.fallback).translate()}
- }
+ renderer = ${props.i18n.id('shortcut.noTargetSelected').translate()}
}
}
}
@@ -73,22 +58,14 @@ prototype(Neos.Neos:Shortcut) < prototype(Neos.Fusion:Component) {
targetUriTag = Neos.Neos:NodeLink {
node = ${props.firstChildNode}
}
- fallback = afx`
- This is a shortcut to the first child page.
- Click {this.targetUriTag} to continue to the page.
- `
- value = ${props.i18n.id('shortcut.clickToContinueToFirstChildNode').arguments([this.targetUriTag]).value(this.fallback).translate()}
+ value = ${props.i18n.id('shortcut.clickToContinueToFirstChildNode').arguments([this.targetUriTag]).translate()}
}
parentNode = Neos.Fusion:Value {
targetUriTag = Neos.Neos:NodeLink {
node = ${props.node.parent}
}
- fallback = afx`
- This is a shortcut to the parent page.
- Click {this.targetUriTag} to continue to the page.
- `
- value = ${props.i18n.id('shortcut.clickToContinueToParentNode').arguments([this.targetUriTag]).value(this.fallback).translate()}
+ value = ${props.i18n.id('shortcut.clickToContinueToParentNode').arguments([this.targetUriTag]).translate()}
}
}
From a776cb06f35dba3e1ea4a8506ae83a004a0598c0 Mon Sep 17 00:00:00 2001
From: mhsdesign <85400359+mhsdesign@users.noreply.github.com>
Date: Wed, 2 Nov 2022 13:37:25 +0100
Subject: [PATCH 003/113] TASK Neos.Neos:Shortcut cleanup Fusion nesting
---
.../Private/Fusion/Prototypes/Shortcut.fusion | 57 +++++++++----------
1 file changed, 26 insertions(+), 31 deletions(-)
diff --git a/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion b/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
index 603210b8f49..bb6b762ef63 100644
--- a/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
+++ b/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
@@ -15,43 +15,38 @@ prototype(Neos.Neos:Shortcut) < prototype(Neos.Fusion:Component) {
selectedTarget = Neos.Fusion:Join {
@glue = ' '
mainMessage = ${props.i18n.id('shortcut.toSpecificTarget').translate()}
- targetMessage = Neos.Fusion:Case {
- targetSelected {
- condition = ${props.target}
- renderer = Neos.Fusion:Match {
- @subject = ${props.targetSchema}
+ targetSelected = Neos.Fusion:Match {
+ @if.isTarget = ${props.target}
- node = Neos.Fusion:Value {
- targetUriTag = Neos.Neos:NodeLink {
- node = ${props.targetConverted}
- }
- value = ${props.i18n.id('shortcut.clickToContinueToPage').arguments([this.targetUriTag]).translate()}
- }
+ @subject = ${props.targetSchema}
- asset = Neos.Fusion:Value {
- targetUriTag = afx`
-
-
- {props.targetConverted.label}
-
- `
- value = ${props.i18n.id('shortcut.clickToContinueToAsset').arguments([this.targetUriTag]).translate()}
- }
-
- @default = Neos.Fusion:Value {
- targetUriTag = afx`
- {props.target}
- `
- value = ${props.i18n.id('shortcut.clickToContinueToExternalUrl').arguments([this.targetUriTag]).translate()}
- }
+ node = Neos.Fusion:Value {
+ targetUriTag = Neos.Neos:NodeLink {
+ node = ${props.targetConverted}
}
+ value = ${props.i18n.id('shortcut.clickToContinueToPage').arguments([this.targetUriTag]).translate()}
}
- noTargetSelected {
- @position = 'end'
- condition = true
- renderer = ${props.i18n.id('shortcut.noTargetSelected').translate()}
+
+ asset = Neos.Fusion:Value {
+ targetUriTag = afx`
+
+
+ {props.targetConverted.label}
+
+ `
+ value = ${props.i18n.id('shortcut.clickToContinueToAsset').arguments([this.targetUriTag]).translate()}
+ }
+
+ @default = Neos.Fusion:Value {
+ targetUriTag = afx`
+ {props.target}
+ `
+ value = ${props.i18n.id('shortcut.clickToContinueToExternalUrl').arguments([this.targetUriTag]).translate()}
}
}
+
+ noTargetSelected = ${props.i18n.id('shortcut.noTargetSelected').translate()}
+ noTargetSelected.@if.isNotTarget = ${!props.target}
}
firstChildNode = Neos.Fusion:Value {
From 1ce5b154f44cd84199ed70a73f4aabb8e06a10c3 Mon Sep 17 00:00:00 2001
From: mhsdesign <85400359+mhsdesign@users.noreply.github.com>
Date: Wed, 2 Nov 2022 13:42:13 +0100
Subject: [PATCH 004/113] TASK Neos.Neos:Shortcut dont cache the backend view
Otherwise, changes from `Neos.Backend.interfaceLanguage()` will not be reflected.
And its like a backend module -> which i wouldn't cache also.
---
.../Resources/Private/Fusion/Prototypes/Shortcut.fusion | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion b/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
index bb6b762ef63..d22fafbe9ef 100644
--- a/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
+++ b/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
@@ -72,5 +72,12 @@ prototype(Neos.Neos:Shortcut) < prototype(Neos.Fusion:Component) {
`
+ @cache {
+ mode = "uncached"
+ context {
+ 0 = "node"
+ }
+ }
+
@exceptionHandler = 'Neos\\Neos\\Fusion\\ExceptionHandlers\\NodeWrappingHandler'
}
From d012fe602348426f3f418d4b477c224d5b342277 Mon Sep 17 00:00:00 2001
From: mhsdesign <85400359+mhsdesign@users.noreply.github.com>
Date: Sat, 12 Nov 2022 11:13:41 +0100
Subject: [PATCH 005/113] BUGFIX 3835 apply suggestions from code review
---
.../Private/Fusion/Prototypes/Shortcut.fusion | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion b/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
index d22fafbe9ef..8b050ee433d 100644
--- a/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
+++ b/Neos.Neos/Resources/Private/Fusion/Prototypes/Shortcut.fusion
@@ -28,12 +28,16 @@ prototype(Neos.Neos:Shortcut) < prototype(Neos.Fusion:Component) {
}
asset = Neos.Fusion:Value {
- targetUriTag = afx`
-
-
- {props.targetConverted.label}
-
- `
+ targetUriTag = Neos.Fusion:Tag {
+ tagName = 'a'
+ attributes {
+ target = '_blank'
+ href = Neos.Fusion:ResourceUri {
+ resource = ${props.targetConverted.resource}
+ }
+ }
+ content = ${props.targetConverted.label}
+ }
value = ${props.i18n.id('shortcut.clickToContinueToAsset').arguments([this.targetUriTag]).translate()}
}
From 888a66bb428e74fff67619b8a9bbbfa5cb8d2ced Mon Sep 17 00:00:00 2001
From: bwaidelich
Date: Tue, 30 May 2023 17:59:22 +0200
Subject: [PATCH 006/113] BUGFIX: Allow disabling of auto-created Image
Variants
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes support for the setting `autoCreateImageVariantPresets` that was
documented for a long time but never actually evaluated.
This change set:
* Adjusts `AssetService::assetCreated()` signal to only trigger `AssetVariantGenerator::createVariants()`
if the `autoCreateImageVariantPresets` flag is set
* Sets the default value of the flag to `true` for greater backwards compatibility
* Adjusts `AssetVariantGenerator::createVariant()` to only create a variant if it does not
exist already – previously multiple variants with the same identifiers could be created for
a single asset leading to undeterministic behavior
* Adds a button "Create missing Variants" to the `Variants` tab of the Media Module
allowing editors to manually trigger creation of (missing) variants.
Fixes: #4300
---
.../Classes/Controller/AssetController.php | 33 +++++++++++++++++++
Neos.Media.Browser/Configuration/Policy.yaml | 2 +-
.../Private/Templates/Asset/Variants.html | 7 ++++
.../Private/Translations/en/Main.xlf | 3 ++
.../Domain/Service/AssetVariantGenerator.php | 6 ++++
Neos.Media/Classes/Package.php | 9 ++++-
Neos.Media/Configuration/Settings.yaml | 2 +-
Neos.Media/Documentation/VariantPresets.rst | 6 ++--
8 files changed, 62 insertions(+), 6 deletions(-)
diff --git a/Neos.Media.Browser/Classes/Controller/AssetController.php b/Neos.Media.Browser/Classes/Controller/AssetController.php
index e82e3d6df41..b1e9ec03449 100644
--- a/Neos.Media.Browser/Classes/Controller/AssetController.php
+++ b/Neos.Media.Browser/Classes/Controller/AssetController.php
@@ -50,6 +50,7 @@
use Neos\Media\Domain\Repository\AssetRepository;
use Neos\Media\Domain\Repository\TagRepository;
use Neos\Media\Domain\Service\AssetService;
+use Neos\Media\Domain\Service\AssetVariantGenerator;
use Neos\Media\Exception\AssetServiceException;
use Neos\Media\TypeConverter\AssetInterfaceConverter;
use Neos\Neos\Controller\BackendUserTranslationTrait;
@@ -140,6 +141,12 @@ class AssetController extends ActionController
*/
protected $assetSourceService;
+ /**
+ * @Flow\Inject
+ * @var AssetVariantGenerator
+ */
+ protected $assetVariantGenerator;
+
/**
* @var AssetSourceInterface[]
*/
@@ -468,6 +475,32 @@ public function variantsAction(string $assetSourceIdentifier, string $assetProxy
}
}
+ /**
+ * (Re-)create all variants for the given image
+ *
+ * @param string $assetSourceIdentifier
+ * @param string $assetProxyIdentifier
+ * @param string $overviewAction
+ * @throws StopActionException
+ * @throws UnsupportedRequestTypeException
+ */
+ public function createVariantsAction(string $assetSourceIdentifier, string $assetProxyIdentifier, string $overviewAction): void
+ {
+ $assetSource = $this->assetSources[$assetSourceIdentifier];
+ $assetProxyRepository = $assetSource->getAssetProxyRepository();
+
+ $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier);
+ $asset = $this->persistenceManager->getObjectByIdentifier($assetProxy->getLocalAssetIdentifier(), Asset::class);
+
+ /** @var VariantSupportInterface $originalAsset */
+ $originalAsset = ($asset instanceof AssetVariantInterface ? $asset->getOriginalAsset() : $asset);
+
+ $this->assetVariantGenerator->createVariants($originalAsset);
+ $this->assetRepository->update($originalAsset);
+
+ $this->redirect('variants', null, null, ['assetSourceIdentifier' => $assetSourceIdentifier, 'assetProxyIdentifier' => $assetProxyIdentifier, 'overviewAction' => $overviewAction]);
+ }
+
/**
* @return void
* @throws NoSuchArgumentException
diff --git a/Neos.Media.Browser/Configuration/Policy.yaml b/Neos.Media.Browser/Configuration/Policy.yaml
index 24e025b8edb..a237114296c 100644
--- a/Neos.Media.Browser/Configuration/Policy.yaml
+++ b/Neos.Media.Browser/Configuration/Policy.yaml
@@ -6,7 +6,7 @@ privilegeTargets:
'Neos.Media.Browser:ManageAssets':
label: Allowed to manage assets
- matcher: 'method(Neos\Media\Browser\Controller\(Asset|Image)Controller->(index|new|show|edit|update|initializeCreate|create|replaceAssetResource|updateAssetResource|initializeUpload|upload|tagAsset|delete|createTag|editTag|updateTag|deleteTag|addAssetToCollection|relatedNodes|variants)Action()) || method(Neos\Media\Browser\Controller\ImageVariantController->(update)Action())'
+ matcher: 'method(Neos\Media\Browser\Controller\(Asset|Image)Controller->(index|new|show|edit|update|initializeCreate|create|replaceAssetResource|updateAssetResource|initializeUpload|upload|tagAsset|delete|createTag|editTag|updateTag|deleteTag|addAssetToCollection|relatedNodes|variants|createVariants)Action()) || method(Neos\Media\Browser\Controller\ImageVariantController->(update)Action())'
'Neos.Media.Browser:AssetUsage':
label: Allowed to calculate asset usages
diff --git a/Neos.Media.Browser/Resources/Private/Templates/Asset/Variants.html b/Neos.Media.Browser/Resources/Private/Templates/Asset/Variants.html
index 0c035452335..e024a452100 100644
--- a/Neos.Media.Browser/Resources/Private/Templates/Asset/Variants.html
+++ b/Neos.Media.Browser/Resources/Private/Templates/Asset/Variants.html
@@ -24,6 +24,13 @@
+
+
+
diff --git a/Neos.Media.Browser/Resources/Private/Translations/en/Main.xlf b/Neos.Media.Browser/Resources/Private/Translations/en/Main.xlf
index 81cddf67e1e..1f9682910d3 100644
--- a/Neos.Media.Browser/Resources/Private/Translations/en/Main.xlf
+++ b/Neos.Media.Browser/Resources/Private/Translations/en/Main.xlf
@@ -427,6 +427,9 @@
+
+
+