File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Resources/doc/features/helpers Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -51,12 +51,25 @@ to only show the flash message once. Something along these lines:
51
51
52
52
var flashes = JSON .parse (decodeURIComponent (cookie));
53
53
54
- // show flashes in your DOM...
54
+ var html = ' ' ;
55
+ for (var key in flashes) {
56
+ if (key === ' length' || ! flashes .hasOwnProperty (key)) {
57
+ continue ;
58
+ }
59
+ html = ' <div class="alert alert-' + key + ' ">' ;
60
+ html += ' <i class="fa fa-info-circle"></i>' ;
61
+ html += flashes[key];
62
+ html += ' </div>' ;
63
+ }
64
+ // YOUR WORK: show flashes in your DOM...
55
65
66
+ // remove the cookie to not show flashes again
56
67
document .cookie = " flashes=; expires=Thu, 01 Jan 1970 00:00:01 GMT;" ;
57
68
}
58
69
59
- // register showFlash on the page ready event.
70
+ // YOUR WORK: register showFlash on the page ready event.
71
+
72
+ The parts about adding the flash messages in the DOM and registering your handler depend on the Javascript framework you use in your page.
60
73
61
74
Your VCL configuration should `filter out this cookie <https://www.varnish-cache.org/trac/wiki/VCLExampleRemovingSomeCookies >`_
62
75
on subsequent requests, in case the JavaScript failed to remove it.
You can’t perform that action at this time.
0 commit comments