forked from SymfonyCasts/symfony-ux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoast-broadcast-a-toast-also.diff
33 lines (31 loc) · 1.11 KB
/
toast-broadcast-a-toast-also.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
diff --git a/templates/broadcast/Review.stream.html.twig b/templates/broadcast/Review.stream.html.twig
index 1acb476..69a9b2d 100644
--- a/templates/broadcast/Review.stream.html.twig
+++ b/templates/broadcast/Review.stream.html.twig
@@ -15,6 +15,15 @@
}) }}
</template>
</turbo-stream>
+
+ <turbo-stream action="append" target="product-{{ entity.product.id }}-toasts">
+ <template>
+ {{ include('_toast.html.twig', {
+ title: 'New Review!',
+ body: 'A new review was just posted for this product'
+ }) }}
+ </template>
+ </turbo-stream>
{% endblock %}
{% block update %}
diff --git a/templates/product/show.html.twig b/templates/product/show.html.twig
index 7af9306..c65713d 100644
--- a/templates/product/show.html.twig
+++ b/templates/product/show.html.twig
@@ -1,6 +1,8 @@
{% extends 'product/productBase.html.twig' %}
{% block productBody %}
+ <div id="product-{{ product.id }}-toasts"></div>
+
<turbo-frame id="product-info" target="_top" class="row pt-3 product-show">
<div class="col-4">
<img