fix: small findings with regard to deletes from sidebar
This commit is contained in:
@@ -211,6 +211,8 @@ config {
|
||||
confirmation_assignments: Set<ConfirmationAssignment> = {
|
||||
ConfirmationAssignment(action: "post_delete", pattern: system_confirm),
|
||||
ConfirmationAssignment(action: "post_discard", pattern: system_confirm),
|
||||
ConfirmationAssignment(action: "template_delete", pattern: confirm_delete_modal),
|
||||
-- shows template title, no reference list
|
||||
ConfirmationAssignment(action: "template_delete_with_references", pattern: system_confirm),
|
||||
ConfirmationAssignment(action: "media_delete", pattern: confirm_delete_modal),
|
||||
-- shows linked posts
|
||||
|
||||
@@ -40,6 +40,7 @@ surface TemplateEditorSurface {
|
||||
when editor.can_publish
|
||||
TemplateValidateRequested(editor.template_id)
|
||||
TemplateDeleteRequested(editor.template_id)
|
||||
TemplateDeleteConfirmed(editor.template_id)
|
||||
TemplateForceDeleteConfirmed(editor.template_id)
|
||||
|
||||
@guarantee HeaderLayout
|
||||
@@ -119,9 +120,20 @@ rule TemplateDelete {
|
||||
-- and M tags. Force delete?" (action_patterns.allium
|
||||
-- confirmation_assignments: template_delete_with_references)
|
||||
else:
|
||||
DeleteTemplateRequested(target)
|
||||
closeTab(template_id)
|
||||
-- no confirmation when nothing references the template
|
||||
ConfirmDeleteModalOpened(template_id)
|
||||
-- custom modal (not a native dialog): template title, no
|
||||
-- reference list; Cancel + Delete (destructive red style)
|
||||
-- — action_patterns.allium
|
||||
-- confirmation_assignments: template_delete
|
||||
}
|
||||
|
||||
rule TemplateDeleteExecute {
|
||||
when: TemplateDeleteConfirmed(template_id)
|
||||
let target = template/Template{id: template_id}
|
||||
ensures: DeleteTemplateRequested(target)
|
||||
-- DB record + .liquid file on disk
|
||||
ensures: closeTab(template_id)
|
||||
-- sidebar removes the item reactively
|
||||
}
|
||||
|
||||
rule TemplateForceDelete {
|
||||
|
||||
@@ -412,8 +412,13 @@ surface TemplateListItemEntry {
|
||||
-- Row is focusable with tabIndex and has aria-label from title.
|
||||
|
||||
@guarantee DeleteConfirmation
|
||||
-- If template is referenced by posts or tags, shows confirmation dialog
|
||||
-- with reference counts before force-delete.
|
||||
-- Delete always confirms before executing. Unreferenced templates
|
||||
-- use the confirm-delete modal (template title, no reference list);
|
||||
-- templates referenced by posts or tags use the force-delete
|
||||
-- confirmation dialog with reference counts.
|
||||
-- See editor_template.allium TemplateDelete and action_patterns.allium
|
||||
-- confirmation_assignments (template_delete,
|
||||
-- template_delete_with_references).
|
||||
|
||||
@guarantee CreateDefaults
|
||||
-- New templates default to: kind=post, content='', enabled=true.
|
||||
|
||||
Reference in New Issue
Block a user