Skip to content

Commit

Permalink
TASK: Introduce module wrapper for workspace module views
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebobo committed Dec 3, 2024
1 parent 6f45693 commit 877315f
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Wrapper to be used for each "full" view like "index" or "review"
#
prototype(Neos.Workspace.Ui:Component.ModuleWrapper) < prototype(Neos.Fusion:Component) {
/// array
flashMessages = ${[]}

/// string
content = ''

Expand All @@ -16,5 +19,6 @@ prototype(Neos.Workspace.Ui:Component.ModuleWrapper) < prototype(Neos.Fusion:Com
>
{props.content}
</section>
<div @if.isNotHTMX={request.format != 'htmx'} id="popover-container"></div>
`
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Neos.Workspace.Ui.WorkspaceController.review = Neos.Fusion:Component {
///todo Neos\ContentRepository\Core\Projection\Workspace\Workspace
/// string
selectedWorkspaceName = ${selectedWorkspaceName}
/// string
selectedWorkspaceLabel = ${selectedWorkspaceLabel}

/// \Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName
baseWorkspaceName = ${baseWorkspaceName}

/// string
baseWorkspaceLabel = ${baseWorkspaceLabel}
/// bool
canPublishToBaseWorkspace = ${canPublishToBaseWorkspace}
Expand All @@ -21,28 +21,23 @@ Neos.Workspace.Ui.WorkspaceController.review = Neos.Fusion:Component {
i18n = ${I18n.id('').source('Main').package('Neos.Workspace.Ui')}

renderer = afx`
<section
id='workspaceReview'
hx-indicator="#indicator"
hx-boost="true"
>
<Neos.Workspace.Ui:Component.HTMXConfig/>
<Neos.Workspace.Ui:Component.FlashMessages flashMessages={props.flashMessages}/>
<Neos.Workspace.Ui:Component.Indicator/>
<main class="neos-content neos-container-fluid">
<div class="neos-row-fluid">
<legend>
{props.i18n.id('workspaces.unpublishedChanges').arguments([selectedWorkspaceLabel]).translate()}
</legend>
<Neos.Workspace.Ui:Component.ModuleWrapper
flashMessages={props.flashMessages}
>
<main id="workspaceReview" class="neos-content neos-container-fluid">
<div class="neos-row-fluid">
<legend>
{props.i18n.id('workspaces.unpublishedChanges').arguments([selectedWorkspaceLabel]).translate()}
</legend>

<Neos.Fusion.Form:Form
form.target.action="publishOrDiscardNodes"
form.target.format="htmx"
form.target.arguments.workspaceName={props.selectedWorkspaceName}
attributes.class="neos-inline"
attributes.hx-post={form.getTarget()}
attributes.id="publishOrDiscardNodesForm"
>
<Neos.Fusion.Form:Form
form.target.action="publishOrDiscardNodes"
form.target.format="htmx"
form.target.arguments.workspaceName={props.selectedWorkspaceName}
attributes.class="neos-inline"
attributes.hx-post={form.getTarget()}
attributes.id="publishOrDiscardNodesForm"
>
<Neos.Workspace.Ui:Component.ReviewTable
@if.hasSiteChanges={props.siteChanges}
siteChanges={props.siteChanges}
Expand All @@ -53,17 +48,16 @@ Neos.Workspace.Ui.WorkspaceController.review = Neos.Fusion:Component {
<div @if.hasNoSiteChange={!props.siteChanges} class="no-unpublished-changes">
{props.i18n.id('workspaces.reviewWorkspace.disabled').arguments([selectedWorkspaceLabel]).translate()}
</div>
<Neos.Workspace.Ui:Component.ReviewActions
hasSiteChanges={!!props.siteChanges}
canPublishToBaseWorkspace={props.canPublishToBaseWorkspace}
canPublishToWorkspace={props.canPublishToWorkspace}
selectedWorkspaceName={props.selectedWorkspaceName}
baseWorkspaceLabel={props.baseWorkspaceLabel}
/>
</Neos.Fusion.Form:Form>
</div>
</main>
</section>
<div @if.isNotHTMX={request.format != 'htmx'} id="popover-container"></div>
`
</Neos.Fusion.Form:Form>
</div>
</main>
<Neos.Workspace.Ui:Component.ReviewActions
hasSiteChanges={!!props.siteChanges}
canPublishToBaseWorkspace={props.canPublishToBaseWorkspace}
canPublishToWorkspace={props.canPublishToWorkspace}
selectedWorkspaceName={props.selectedWorkspaceName}
baseWorkspaceLabel={props.baseWorkspaceLabel}
/>
</Neos.Workspace.Ui:Component.ModuleWrapper>
`
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ prototype(Neos.Workspace.Ui:Component.ReviewActions) < prototype(Neos.Fusion:Com
attributes.hx-get={private.indexWorkspaceUri}
attributes.hx-replace-url={private.indexWorkspaceUri}
attributes.hx-select="#workspace-module-content"
attributes.hx-target="#workspaceReview"
attributes.hx-target="#workspace-module-content"
attributes.hx-swap="outerHTML"
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ Neos.Workspace.Ui.WorkspaceController.index = Neos.Fusion:Component {
userWorkspaceName = ${userWorkspaceName}
/// Neos\Workspace\Ui\ViewModel\WorkspaceListItems
workspaceListItems = ${workspaceListItems}
/// array
flashMessages = ${flashMessages}

newAction = Neos.Fusion:UriBuilder {
action = 'new'
Expand All @@ -18,15 +16,10 @@ Neos.Workspace.Ui.WorkspaceController.index = Neos.Fusion:Component {
renderer = Neos.Fusion:Match {
@subject = ${request.format}
@default = afx`
<section
id="workspace-module-content"
hx-indicator="#indicator"
hx-boost="true"
<Neos.Workspace.Ui:Component.ModuleWrapper
flashMessages={props.flashMessages}
>
<Neos.Workspace.Ui:Component.HTMXConfig/>
<Neos.Workspace.Ui:Component.FlashMessages flashMessages={props.flashMessages}/>
<Neos.Workspace.Ui:Component.Indicator/>
<main class="neos-content neos-container-fluid" id="workspace-module-swap-me">
<main class="neos-content neos-container-fluid">
<div class="neos-row-fluid">
<Neos.Workspace.Ui:Component.WorkspaceTable
userWorkspaceName={props.userWorkspaceName}
Expand All @@ -51,8 +44,7 @@ Neos.Workspace.Ui.WorkspaceController.index = Neos.Fusion:Component {
workspaceCount={Array.length(props.workspaceListItems)}
/>
</Neos.Workspace.Ui:Component.Footer>
</section>
<div id="popover-container"></div>
</Neos.Workspace.Ui:Component.ModuleWrapper>
`

htmx = afx`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@ prototype(Neos.Workspace.Ui:Component.WorkspaceTableRow) < prototype(Neos.Fusion
}
reviewWorkspaceUri = Neos.Fusion:ActionUri {
action = 'review'
format = 'htmx'
arguments {
workspace = ${props.workspaceListItem.name}
}
}
reviewWorkspaceFullUri = Neos.Fusion:ActionUri {
action = 'review'
format = 'html'
arguments {
workspace = ${props.workspaceListItem.name}
}
Expand Down Expand Up @@ -137,8 +131,9 @@ prototype(Neos.Workspace.Ui:Component.WorkspaceTableRow) < prototype(Neos.Fusion
title={private.i18n.id(props.workspaceListItem.pendingChanges.total ? 'workspaces.reviewWorkspace' : 'workspaces.reviewWorkspace.noChanges').arguments([props.workspaceListItem.title])}
attributes.disabled={props.workspaceListItem.pendingChanges.total == 0}
attributes.hx-get={private.reviewWorkspaceUri}
attributes.hx-replace-url={private.reviewWorkspaceFullUri}
attributes.hx-replace-url={private.reviewWorkspaceUri}
attributes.hx-target="#workspace-module-content"
attributes.hx-select="#workspace-module-content"
attributes.hx-swap="outerHTML"
/>
<Neos.Workspace.Ui:Component.Button
Expand Down

0 comments on commit 877315f

Please sign in to comment.