diff --git a/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php b/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php index d221fa3ebfd..e9fe075ddb0 100644 --- a/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php +++ b/Neos.Workspace.Ui/Classes/Controller/WorkspaceController.php @@ -46,10 +46,12 @@ use Neos\Flow\I18n\Exception\InvalidFormatPlaceholderException; use Neos\Flow\Mvc\ActionRequest; use Neos\Flow\Mvc\Exception\StopActionException; +use Neos\Flow\Mvc\View\ViewInterface; use Neos\Flow\Package\PackageManager; use Neos\Flow\Property\PropertyMapper; use Neos\Flow\Security\Account; use Neos\Flow\Security\Context; +use Neos\Fusion\View\FusionView; use Neos\Media\Domain\Model\AssetInterface; use Neos\Media\Domain\Model\ImageInterface; use Neos\Neos\Controller\Module\AbstractModuleController; @@ -79,6 +81,8 @@ class WorkspaceController extends AbstractModuleController use ModuleTranslationTrait; use NodeTypeWithFallbackProvider; + protected $defaultViewObjectName = FusionView::class; + #[Flow\Inject] protected ContentRepositoryRegistry $contentRepositoryRegistry; @@ -103,6 +107,18 @@ class WorkspaceController extends AbstractModuleController #[Flow\Inject] protected WorkspaceProvider $workspaceProvider; + protected function initializeView(ViewInterface $view): void + { + parent::initializeView($view); + // If we're in a HTMX-request... + if ($this->request->getHttpRequest()->hasHeader('HX-Request')) { + // We append an "/htmx" segment to the fusion path, changing it from "//" to "///htmx" + $htmxFusionPath = str_replace(['\\Controller\\', '\\'], ['\\', '/'], $this->request->getControllerObjectName()); + $htmxFusionPath .= '/' . $this->request->getControllerActionName() . '/htmx'; + $view->setOption('fusionPath', $htmxFusionPath); + } + } + /** * Display a list of unpublished content */ diff --git a/Neos.Workspace.Ui/Configuration/Settings.Neos.yaml b/Neos.Workspace.Ui/Configuration/Settings.Neos.yaml index 501297b6ca8..e1a99b6888a 100644 --- a/Neos.Workspace.Ui/Configuration/Settings.Neos.yaml +++ b/Neos.Workspace.Ui/Configuration/Settings.Neos.yaml @@ -10,6 +10,8 @@ Neos: icon: fas fa-th-large mainStylesheet: 'Lite' additionalResources: + javaScripts: + 'Neos.Workspace.Ui': 'resource://Neos.Workspace.Ui/Public/Scripts/htmx.min.js' styleSheets: 'Neos.Workspace.Ui': 'resource://Neos.Workspace.Ui/Public/Styles/Module.css' diff --git a/Neos.Workspace.Ui/Configuration/Views.yaml b/Neos.Workspace.Ui/Configuration/Views.yaml index dccdf779490..2c3dc641912 100644 --- a/Neos.Workspace.Ui/Configuration/Views.yaml +++ b/Neos.Workspace.Ui/Configuration/Views.yaml @@ -1,11 +1,11 @@ -- requestFilter: 'isPackage("Neos.Workspace.Ui") && isController("Workspace") && isFormat("html")' +- requestFilter: 'isPackage("Neos.Workspace.Ui") && isController("Workspace") && isFormat("html") && isAction("show")' options: layoutRootPathPattern: 'resource://Neos.Neos/Private/Layouts' partialRootPaths: - 'resource://Neos.Workspace.Ui/Private/Partials' - 'resource://Neos.Neos/Private/Partials' -- requestFilter: 'isPackage("Neos.Workspace.Ui") && isController("Workspace") && isFormat("html") && (isAction("index") || isAction("new") || isAction("edit"))' +- requestFilter: 'isPackage("Neos.Workspace.Ui") && isController("Workspace") && (isFormat("html") || isFormat("htmx")) && (isAction("index") || isAction("new") || isAction("edit"))' viewObjectName: 'Neos\Fusion\View\FusionView' options: fusionPathPatterns: diff --git a/Neos.Workspace.Ui/Resources/Private/Fusion/Components/FlashMessages.fusion b/Neos.Workspace.Ui/Resources/Private/Fusion/Components/FlashMessages.fusion index 23233b73c40..c383faa2c50 100644 --- a/Neos.Workspace.Ui/Resources/Private/Fusion/Components/FlashMessages.fusion +++ b/Neos.Workspace.Ui/Resources/Private/Fusion/Components/FlashMessages.fusion @@ -2,7 +2,11 @@ prototype(Neos.Workspace.Ui:Component.FlashMessages) < prototype(Neos.Fusion:Com flashMessages = ${[]} renderer = afx` -
+
diff --git a/Neos.Workspace.Ui/Resources/Private/Fusion/Components/Modals/Delete.fusion b/Neos.Workspace.Ui/Resources/Private/Fusion/Components/Modals/Delete.fusion index bb360fd3417..ec24966b130 100644 --- a/Neos.Workspace.Ui/Resources/Private/Fusion/Components/Modals/Delete.fusion +++ b/Neos.Workspace.Ui/Resources/Private/Fusion/Components/Modals/Delete.fusion @@ -34,8 +34,13 @@ prototype(Neos.Workspace.Ui:Component.Modal.Delete) < prototype(Neos.Fusion:Comp