feat(cabana): mail layouts and partials screens with reset, drift and custom layouts

- Layouts and partials controllers with catalog scoping, reset action and File version diff
- Custom layout create/delete with in-use refusal; meta.deletable and customized/outdated row states
- List schema golden fixtures updated for the two new row-state message keys

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-13 12:33:20 +01:00
parent 7efb9ed7ad
commit 83f76cc3f7
35 changed files with 1868 additions and 18 deletions

View File

@@ -0,0 +1,11 @@
{{- /* The File version tab (mailFileVersionView): the line diff of the override against the file, then the file itself. */ -}}
{{- with .Data -}}
{{- if .CustomLayout }}<p class="text-muted">{{ trans "backend::lang.mail.info_custom_layout" }}</p>{{ end -}}
{{- if .Show -}}
{{- if .Customized -}}
{{- if .Identical }}<p>{{ trans "backend::lang.mail.file_identical" }}</p>
{{- else if .Diff }}<p><strong>{{ trans "backend::lang.mail.file_changes" }}</strong></p><p class="text-muted">{{ trans "backend::lang.mail.file_legend" }}</p><pre class="summer-diff">{{ range .Diff }}<span class="{{ .Class }}">{{ .Text }}</span>{{ end }}</pre>{{ end -}}
{{- else }}<p class="text-muted">{{ trans "backend::lang.mail.file_not_customized" }}</p>{{ end -}}
<p><strong>{{ trans "backend::lang.mail.file_content" }}</strong></p><pre class="summer-diff">{{ range .Content }}<span class="summer-diff__ctx">{{ . }}</span>{{ end }}</pre>
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,10 @@
{{- /* Lines at the top of a mail form (mailInfoView): description, file or custom code, status, sample variables, partial call, drift callout. */ -}}
{{- with .Data -}}
{{- if .Description }}<p>{{ .Description }}</p>{{ end -}}
{{- if .File }}<p class="text-muted">{{ range .File }}{{ if .Code }}<code class="font-mono">{{ .Text }}</code>{{ else }}{{ .Text }}{{ end }}{{ end }}</p>{{ end -}}
{{- if .CustomCode }}<p class="text-muted">{{ trans "backend::lang.mail.info_custom_layout" }} <code class="font-mono">{{ .CustomCode }}</code></p>{{ end -}}
{{- if .Status }}<p><strong>{{ trans .Status }}</strong></p>{{ end -}}
{{- if .Template }}{{ if .Variables }}<p>{{ trans "backend::lang.mail.info_variables" }} {{ range $i, $name := .Variables }}{{ if $i }}, {{ end }}<code class="font-mono">{{ $name }}</code>{{ end }}</p>{{ else }}<p>{{ trans "backend::lang.mail.info_no_samples" }}</p>{{ end }}{{ end -}}
{{- if .Usage }}<p>{{ trans "backend::lang.mail.info_partial_usage" }} <code class="font-mono">{{ .Usage }}</code></p>{{ end -}}
{{- if .Outdated }}<div class="summer-callout summer-callout--warning" role="status"><p class="summer-callout__title">{{ trans "backend::lang.mail.drift_title" }}</p><p class="summer-callout__text">{{ trans "backend::lang.mail.drift_text" }}</p></div>{{ end -}}
{{- end -}}

View File

@@ -0,0 +1,6 @@
scopes:
status:
label: backend::lang.mail.filter_status
modelClass: System\Models\MailLayout
nameFrom: code
scope: filterStatus

View File

@@ -0,0 +1,21 @@
name: backend::lang.mail.layout.name
form: ~/plugins/summercms/cabana/models/maillayout/fields.yaml
modelClass: System\Models\MailLayout
defaultRedirect: summercms/cabana/maillayouts
create:
redirect: summercms/cabana/maillayouts/update/:id
redirectClose: summercms/cabana/maillayouts
update:
redirect: summercms/cabana/maillayouts/update/:id
redirectClose: summercms/cabana/maillayouts
recordActions: [reset]
messages:
create: backend::lang.mail.layout.new
update: backend::lang.mail.layout.name
saved: backend::lang.messages.form.saved
deleteConfirm: backend::lang.mail.layout.delete_confirm
deleted: backend::lang.messages.form.deleted

View File

@@ -0,0 +1,22 @@
list: ~/plugins/summercms/cabana/models/maillayout/columns.yaml
modelClass: System\Models\MailLayout
title: backend::lang.mail.layout.list_title
recordUrl: summercms/cabana/maillayouts/update/:id
noRecordsMessage: backend::lang.mail.layout.list_empty
recordsPerPage: 20
showCheckboxes: false
filter: config_filter.yaml
defaultSort:
column: name
direction: asc
toolbar:
buttons: [create]
search:
prompt: backend::lang.list.search_prompt
messages:
create: backend::lang.mail.layout.new
empty: backend::lang.mail.layout.list_empty
rowStateCustomized: backend::lang.mail.state_customized
rowStateOutdated: backend::lang.mail.state_outdated

View File

@@ -0,0 +1,11 @@
{{- /* The File version tab (mailFileVersionView): the line diff of the override against the file, then the file itself. */ -}}
{{- with .Data -}}
{{- if .CustomLayout }}<p class="text-muted">{{ trans "backend::lang.mail.info_custom_layout" }}</p>{{ end -}}
{{- if .Show -}}
{{- if .Customized -}}
{{- if .Identical }}<p>{{ trans "backend::lang.mail.file_identical" }}</p>
{{- else if .Diff }}<p><strong>{{ trans "backend::lang.mail.file_changes" }}</strong></p><p class="text-muted">{{ trans "backend::lang.mail.file_legend" }}</p><pre class="summer-diff">{{ range .Diff }}<span class="{{ .Class }}">{{ .Text }}</span>{{ end }}</pre>{{ end -}}
{{- else }}<p class="text-muted">{{ trans "backend::lang.mail.file_not_customized" }}</p>{{ end -}}
<p><strong>{{ trans "backend::lang.mail.file_content" }}</strong></p><pre class="summer-diff">{{ range .Content }}<span class="summer-diff__ctx">{{ . }}</span>{{ end }}</pre>
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,10 @@
{{- /* Lines at the top of a mail form (mailInfoView): description, file or custom code, status, sample variables, partial call, drift callout. */ -}}
{{- with .Data -}}
{{- if .Description }}<p>{{ .Description }}</p>{{ end -}}
{{- if .File }}<p class="text-muted">{{ range .File }}{{ if .Code }}<code class="font-mono">{{ .Text }}</code>{{ else }}{{ .Text }}{{ end }}{{ end }}</p>{{ end -}}
{{- if .CustomCode }}<p class="text-muted">{{ trans "backend::lang.mail.info_custom_layout" }} <code class="font-mono">{{ .CustomCode }}</code></p>{{ end -}}
{{- if .Status }}<p><strong>{{ trans .Status }}</strong></p>{{ end -}}
{{- if .Template }}{{ if .Variables }}<p>{{ trans "backend::lang.mail.info_variables" }} {{ range $i, $name := .Variables }}{{ if $i }}, {{ end }}<code class="font-mono">{{ $name }}</code>{{ end }}</p>{{ else }}<p>{{ trans "backend::lang.mail.info_no_samples" }}</p>{{ end }}{{ end -}}
{{- if .Usage }}<p>{{ trans "backend::lang.mail.info_partial_usage" }} <code class="font-mono">{{ .Usage }}</code></p>{{ end -}}
{{- if .Outdated }}<div class="summer-callout summer-callout--warning" role="status"><p class="summer-callout__title">{{ trans "backend::lang.mail.drift_title" }}</p><p class="summer-callout__text">{{ trans "backend::lang.mail.drift_text" }}</p></div>{{ end -}}
{{- end -}}

View File

@@ -0,0 +1,6 @@
scopes:
status:
label: backend::lang.mail.filter_status
modelClass: System\Models\MailPartial
nameFrom: code
scope: filterStatus

View File

@@ -0,0 +1,14 @@
name: backend::lang.mail.partial.name
form: ~/plugins/summercms/cabana/models/mailpartial/fields.yaml
modelClass: System\Models\MailPartial
defaultRedirect: summercms/cabana/mailpartials
update:
redirect: summercms/cabana/mailpartials/update/:id
redirectClose: summercms/cabana/mailpartials
recordActions: [reset]
messages:
update: backend::lang.mail.partial.name
saved: backend::lang.messages.form.saved

View File

@@ -0,0 +1,21 @@
list: ~/plugins/summercms/cabana/models/mailpartial/columns.yaml
modelClass: System\Models\MailPartial
title: backend::lang.mail.partial.list_title
recordUrl: summercms/cabana/mailpartials/update/:id
noRecordsMessage: backend::lang.mail.partial.list_empty
recordsPerPage: 20
showCheckboxes: false
filter: config_filter.yaml
defaultSort:
column: code
direction: asc
toolbar:
buttons: []
search:
prompt: backend::lang.list.search_prompt
messages:
empty: backend::lang.mail.partial.list_empty
rowStateCustomized: backend::lang.mail.state_customized
rowStateOutdated: backend::lang.mail.state_outdated

View File

@@ -0,0 +1,11 @@
{{- /* The File version tab (mailFileVersionView): the line diff of the override against the file, then the file itself. */ -}}
{{- with .Data -}}
{{- if .CustomLayout }}<p class="text-muted">{{ trans "backend::lang.mail.info_custom_layout" }}</p>{{ end -}}
{{- if .Show -}}
{{- if .Customized -}}
{{- if .Identical }}<p>{{ trans "backend::lang.mail.file_identical" }}</p>
{{- else if .Diff }}<p><strong>{{ trans "backend::lang.mail.file_changes" }}</strong></p><p class="text-muted">{{ trans "backend::lang.mail.file_legend" }}</p><pre class="summer-diff">{{ range .Diff }}<span class="{{ .Class }}">{{ .Text }}</span>{{ end }}</pre>{{ end -}}
{{- else }}<p class="text-muted">{{ trans "backend::lang.mail.file_not_customized" }}</p>{{ end -}}
<p><strong>{{ trans "backend::lang.mail.file_content" }}</strong></p><pre class="summer-diff">{{ range .Content }}<span class="summer-diff__ctx">{{ . }}</span>{{ end }}</pre>
{{- end -}}
{{- end -}}

View File

@@ -0,0 +1,10 @@
{{- /* Lines at the top of a mail form (mailInfoView): description, file or custom code, status, sample variables, partial call, drift callout. */ -}}
{{- with .Data -}}
{{- if .Description }}<p>{{ .Description }}</p>{{ end -}}
{{- if .File }}<p class="text-muted">{{ range .File }}{{ if .Code }}<code class="font-mono">{{ .Text }}</code>{{ else }}{{ .Text }}{{ end }}{{ end }}</p>{{ end -}}
{{- if .CustomCode }}<p class="text-muted">{{ trans "backend::lang.mail.info_custom_layout" }} <code class="font-mono">{{ .CustomCode }}</code></p>{{ end -}}
{{- if .Status }}<p><strong>{{ trans .Status }}</strong></p>{{ end -}}
{{- if .Template }}{{ if .Variables }}<p>{{ trans "backend::lang.mail.info_variables" }} {{ range $i, $name := .Variables }}{{ if $i }}, {{ end }}<code class="font-mono">{{ $name }}</code>{{ end }}</p>{{ else }}<p>{{ trans "backend::lang.mail.info_no_samples" }}</p>{{ end }}{{ end -}}
{{- if .Usage }}<p>{{ trans "backend::lang.mail.info_partial_usage" }} <code class="font-mono">{{ .Usage }}</code></p>{{ end -}}
{{- if .Outdated }}<div class="summer-callout summer-callout--warning" role="status"><p class="summer-callout__title">{{ trans "backend::lang.mail.drift_title" }}</p><p class="summer-callout__text">{{ trans "backend::lang.mail.drift_text" }}</p></div>{{ end -}}
{{- end -}}

View File

@@ -0,0 +1,11 @@
scopes:
locale:
label: backend::lang.mail.template.locale
modelClass: System\Models\MailTemplate
nameFrom: code
scope: filterLocale
status:
label: backend::lang.mail.filter_status
modelClass: System\Models\MailTemplate
nameFrom: code
scope: filterStatus

View File

@@ -7,6 +7,8 @@ update:
redirect: summercms/cabana/mailtemplates/update/:id
redirectClose: summercms/cabana/mailtemplates
recordActions: [reset]
messages:
update: backend::lang.mail.template.name
saved: backend::lang.messages.form.saved

View File

@@ -5,6 +5,7 @@ recordUrl: summercms/cabana/mailtemplates/update/:id
noRecordsMessage: backend::lang.mail.template.list_empty
recordsPerPage: 20
showCheckboxes: false
filter: config_filter.yaml
defaultSort:
column: code
direction: asc
@@ -16,3 +17,5 @@ toolbar:
messages:
empty: backend::lang.mail.template.list_empty
rowStateCustomized: backend::lang.mail.state_customized
rowStateOutdated: backend::lang.mail.state_outdated

View File

@@ -0,0 +1,17 @@
columns:
name:
label: backend::lang.mail.name_field
searchable: true
sortable: true
code:
label: backend::lang.mail.code
searchable: true
sortable: true
source:
label: backend::lang.mail.source
sortable: true
customized_at:
label: backend::lang.mail.customized_at
type: datetime
invisible: true
sortable: true

View File

@@ -0,0 +1,51 @@
fields:
_info:
type: partial
path: info
span: full
context: update
tab: backend::lang.mail.layout.tab_html
name:
label: backend::lang.mail.name_field
type: text
span: left
required: true
tab: backend::lang.mail.layout.tab_html
code:
label: backend::lang.mail.code
comment: backend::lang.mail.layout.code_comment
type: text
span: right
required: true
context: create
tab: backend::lang.mail.layout.tab_html
preset:
type: slug
field: name
content_html:
label: backend::lang.mail.layout.html
comment: backend::lang.mail.layout.html_comment
type: textarea
size: giant
span: full
tab: backend::lang.mail.layout.tab_html
content_text:
label: backend::lang.mail.layout.text
comment: backend::lang.mail.layout.text_comment
type: textarea
size: huge
span: full
tab: backend::lang.mail.layout.tab_text
content_css:
label: backend::lang.mail.layout.css
comment: backend::lang.mail.layout.css_comment
type: textarea
size: huge
span: full
tab: backend::lang.mail.layout.tab_css
_file_version:
type: partial
path: file_version
span: full
context: update
tab: backend::lang.mail.tab_file_version

View File

@@ -0,0 +1,13 @@
columns:
code:
label: backend::lang.mail.code
searchable: true
sortable: true
source:
label: backend::lang.mail.source
sortable: true
customized_at:
label: backend::lang.mail.customized_at
type: datetime
invisible: true
sortable: true

View File

@@ -0,0 +1,26 @@
fields:
_info:
type: partial
path: info
span: full
tab: backend::lang.mail.partial.tab_html
content_html:
label: backend::lang.mail.partial.html
comment: backend::lang.mail.partial.html_comment
type: textarea
size: huge
span: full
tab: backend::lang.mail.partial.tab_html
content_text:
label: backend::lang.mail.partial.text
comment: backend::lang.mail.partial.text_comment
type: textarea
size: large
span: full
tab: backend::lang.mail.partial.tab_text
_file_version:
type: partial
path: file_version
span: full
context: update
tab: backend::lang.mail.tab_file_version

View File

@@ -1,4 +1,9 @@
fields:
_info:
type: partial
path: info
span: full
tab: backend::lang.mail.template.tab_template
subject:
label: backend::lang.mail.template.subject
comment: backend::lang.mail.template.subject_comment
@@ -21,3 +26,9 @@ fields:
size: giant
span: full
tab: backend::lang.mail.template.tab_template
_file_version:
type: partial
path: file_version
span: full
context: update
tab: backend::lang.mail.tab_file_version