mirror of
https://github.com/karatektus/pl_mail.git
synced 2026-10-25 10:04:18 +00:00
chore(dead-code): one shared toast turbo-stream partial
Twenty-one stream responses each spelled out the same append-to- toast-region wrapper around _toast.html.twig. They now include _partials/_toast.stream.html.twig with the same message and type, so the markup is unchanged. Compose streams (owned elsewhere) and _send_outcome (passes extra hide_after) are left as they are. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c0b969ebb6
commit
bcd332edf1
22 files changed
+37
-141
No files matched your search
@@ -0,0 +1,16 @@
|
||||
{#
|
||||
One toast, appended to the toast region.
|
||||
|
||||
The five lines nearly every stream response carries beside the fragment it
|
||||
replaces; written once here so the target id and the wrapper cannot drift apart
|
||||
between them.
|
||||
|
||||
message already translated
|
||||
type success | error | info (default success)
|
||||
extra optional, see _toast.html.twig (hide_after, undo_url, undo_label)
|
||||
#}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with { message: message, type: type ?? 'success', extra: extra ?? {} } only %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
@@ -6,14 +6,7 @@
|
||||
<template></template>
|
||||
</turbo-stream>
|
||||
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: toastMessage|trans,
|
||||
type: 'success',
|
||||
} %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: 'success' } only %}
|
||||
|
||||
{# Sidebar list (mail pages) — uses the active-only accounts global. #}
|
||||
<turbo-stream action="replace" target="account-list">
|
||||
|
||||
@@ -6,11 +6,7 @@ status chip and can change what the *other* rows say about connectability, and
|
||||
the list is cheap.
|
||||
#}
|
||||
{% if toastMessage is not empty %}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with { message: toastMessage|trans, type: 'success' } %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: 'success' } only %}
|
||||
{% endif %}
|
||||
|
||||
<turbo-stream action="replace" target="admin-integrations">
|
||||
|
||||
@@ -17,14 +17,7 @@ Accepts:
|
||||
{# Before the list, so the toast is appended even if rendering the frame
|
||||
below fails on something — a refusal that is swallowed by a template
|
||||
error is the exact failure this variable exists to end. #}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: toastMessage|trans,
|
||||
type: toastType|default('error'),
|
||||
} only %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: toastType|default('error') } only %}
|
||||
{% endif %}
|
||||
|
||||
<turbo-stream action="replace" target="admin-users">
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with { message: toastMessage|trans, type: 'success' } %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: 'success' } only %}
|
||||
|
||||
<turbo-stream action="replace" target="settings-alias-list">
|
||||
<template>
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with { message: toastMessage|trans, type: toastType } %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: toastType } only %}
|
||||
|
||||
<turbo-stream action="replace" target="settings-app-password-list">
|
||||
<template>
|
||||
|
||||
@@ -22,11 +22,4 @@ Variables:
|
||||
</turbo-stream>
|
||||
{% endif %}
|
||||
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: toastMessage|trans,
|
||||
type: toastType,
|
||||
} %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: toastType } only %}
|
||||
@@ -23,14 +23,7 @@ Variables:
|
||||
toastMessage string translation key
|
||||
toastParameters array placeholders for it, e.g. { '%count%': 2 }
|
||||
#}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: toastMessage|trans(toastParameters|default({})),
|
||||
type: 'success',
|
||||
} %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans(toastParameters|default({})), type: 'success' } only %}
|
||||
|
||||
{# The target id is re-emitted inside its own replacement. A replace whose
|
||||
template drops the id works exactly once: the second stream finds nothing
|
||||
|
||||
@@ -20,11 +20,4 @@ Variables:
|
||||
#}
|
||||
<turbo-stream action="remove" target="proposal_card_{{ messageId }}"></turbo-stream>
|
||||
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: toastMessage|trans,
|
||||
type: toastType,
|
||||
} %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: toastType } only %}
|
||||
@@ -6,11 +6,4 @@ its attachments are exactly as they were — so there is no frame worth
|
||||
replacing. The confirmation is the whole response, which also means the thread
|
||||
keeps its scroll position.
|
||||
#}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: toastMessage|trans(toastParams),
|
||||
type: isError ? 'error' : 'success',
|
||||
} %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans(toastParams), type: isError ? 'error' : 'success' } only %}
|
||||
@@ -15,14 +15,7 @@ Variables:
|
||||
toastMessage string|null translation key
|
||||
#}
|
||||
{% if toastMessage is not empty %}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: toastMessage|trans,
|
||||
type: 'success',
|
||||
} %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: 'success' } only %}
|
||||
{% endif %}
|
||||
|
||||
<turbo-stream action="replace" target="settings-label-list">
|
||||
|
||||
@@ -33,11 +33,4 @@ Variables: job
|
||||
</template>
|
||||
</turbo-stream>
|
||||
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
type: 'info',
|
||||
message: 'jobs.started'|trans({ '%action%': job.kind.labelKey()|trans|lower }),
|
||||
} only %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { type: 'info', message: 'jobs.started'|trans({ '%action%': job.kind.labelKey()|trans|lower }) } only %}
|
||||
@@ -11,11 +11,7 @@ disappears takes its "last delivery" line with it, and the empty state has to
|
||||
appear when the last row goes. Re-rendering the partial is how that stays the
|
||||
same markup the full page renders, instead of a second opinion about it.
|
||||
#}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with { message: toastMessage|trans, type: 'success' } %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: 'success' } only %}
|
||||
|
||||
<turbo-stream action="replace" target="settings-push-device-list">
|
||||
<template>
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with { message: toastMessage|trans, type: 'success' } %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: 'success' } only %}
|
||||
|
||||
{# The whole panel, not the one select that changed — see
|
||||
ComposeDefaultsController::streamResponse() for why. #}
|
||||
|
||||
@@ -8,11 +8,7 @@ carries the field errors as well, and the toast says only that nothing was
|
||||
written; which of the four refusals it was is printed under the field it
|
||||
belongs to.
|
||||
#}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with { message: toastMessage|trans, type: toastType } only %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: toastType } only %}
|
||||
|
||||
<turbo-stream action="replace" target="settings-password">
|
||||
<template>
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with { message: toastMessage|trans, type: 'success' } %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: 'success' } only %}
|
||||
|
||||
{# The whole panel, not the one row that changed — see
|
||||
SignatureController::streamResponse() for why. #}
|
||||
|
||||
@@ -6,11 +6,7 @@ answers "did that work", and leaving a stale editor open invites a second save
|
||||
of the rule that was just written.
|
||||
#}
|
||||
{% if toastMessage is not empty %}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with { message: toastMessage|trans, type: 'success' } %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: 'success' } only %}
|
||||
{% endif %}
|
||||
|
||||
{# Replaces the frame, not just its inner div: the frame carries the src that
|
||||
|
||||
@@ -8,14 +8,7 @@ success, and the reason is already spelled out on the row itself.
|
||||
{% set isFailure = toastMessage ends with '_failed' or toastMessage ends with '_with_error' %}
|
||||
|
||||
{% if toastMessage is not empty %}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: toastMessage|trans,
|
||||
type: isFailure ? 'error' : 'success',
|
||||
} %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: isFailure ? 'error' : 'success' } only %}
|
||||
{% endif %}
|
||||
|
||||
<turbo-stream action="replace" target="settings-integrations-frame">
|
||||
|
||||
@@ -17,14 +17,7 @@ Variables:
|
||||
mintedLinkUrl string|null shown once, then never again
|
||||
mintedBookingUrl string|null shown once, then never again
|
||||
#}
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: toastMessage|trans,
|
||||
type: 'success',
|
||||
} %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: toastMessage|trans, type: 'success' } only %}
|
||||
|
||||
{# The target id is re-emitted inside its own replacement: a replace whose
|
||||
template drops the id works exactly once, and the second stream silently
|
||||
|
||||
@@ -21,10 +21,4 @@ Variables:
|
||||
leaves: true,
|
||||
} only %}
|
||||
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: 'toast.categorised'|trans({ '%category%': ('tabs.' ~ category.value)|trans }),
|
||||
} only %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: 'toast.categorised'|trans({ '%category%': ('tabs.' ~ category.value)|trans }) } only %}
|
||||
@@ -24,10 +24,4 @@ Variables:
|
||||
leaves: false,
|
||||
} only %}
|
||||
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: 'toast.labelled'|trans({ '%label%': label|label_name }),
|
||||
} only %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: 'toast.labelled'|trans({ '%label%': label|label_name }) } only %}
|
||||
@@ -38,10 +38,4 @@ Variables:
|
||||
leaves: true,
|
||||
} only %}
|
||||
|
||||
<turbo-stream action="append" target="toast-region">
|
||||
<template>
|
||||
{% include '_partials/_toast.html.twig' with {
|
||||
message: 'toast.moved'|trans({ '%folder%': label|label_name }),
|
||||
} only %}
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% include '_partials/_toast.stream.html.twig' with { message: 'toast.moved'|trans({ '%folder%': label|label_name }) } only %}
|
||||
Reference in new issue
Block a user