forked from SymfonyCasts/symfony-ux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoast-include-customize.diff
36 lines (34 loc) · 1.45 KB
/
toast-include-customize.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
diff --git a/templates/_toast.html.twig b/templates/_toast.html.twig
index cb0dc9c..5c369d1 100644
--- a/templates/_toast.html.twig
+++ b/templates/_toast.html.twig
@@ -1,12 +1,12 @@
<div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<svg class="rounded me-2" width="20" height="20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" preserveAspectRatio="xMidYMid slice" focusable="false"><rect width="100%" height="100%" fill="#007aff"></rect></svg>
- <strong class="me-auto">Bootstrap</strong>
- <small>11 mins ago</small>
+ <strong class="me-auto">{{ title }}</strong>
+ <small>{{ when|default('just now') }}</small>
<button type="button" class="btn-close" data-bs-dismiss="toast"
aria-label="Close"></button>
</div>
<div class="toast-body">
- Hello, world! This is a toast message.
+ {{ body }}
</div>
</div>
diff --git a/templates/product/_reviews.html.twig b/templates/product/_reviews.html.twig
index f6f5cbe..32b549d 100644
--- a/templates/product/_reviews.html.twig
+++ b/templates/product/_reviews.html.twig
@@ -7,7 +7,10 @@
<turbo-frame id="product-reviews-form">
{% for flash in app.flashes('review_success') %}
- <div class="alert alert-success">{{ flash }}</div>
+ {{ include('_toast.html.twig', {
+ title: 'Success!',
+ body: flash
+ }) }}
{% endfor %}
{% if reviewForm|default(false) %}