You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
758 B

8 months ago
8 months ago
8 months ago
4 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. <% if flash.count.positive? %>
  2. <script data-turbo-temporary>
  3. document.addEventListener('turbo:load',(e)=>{
  4. const common={
  5. gravity: 'top',
  6. position: 'center',
  7. duration: 4000,
  8. offset: { y: '1em' },
  9. close: true
  10. }
  11. const notice={ className: 'toastify-notice', ...common }
  12. const alert={ className: 'toastify-alert', ...common }
  13. <% if flash.notice%>
  14. Toastify({ text: '<%=flash.notice%>', ...notice}).showToast();
  15. <%end%>
  16. <% if flash.alert%>
  17. Toastify({ text: '<%=flash.alert%>', ...alert}).showToast();
  18. <%end%>
  19. // useful to prevent flickering from turbo preview
  20. Turbo.cache.exemptPageFromPreview()
  21. }, {once: true})
  22. </script>
  23. <%end%>