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.
 
 
 
 
 

29 lines
771 B

NOTIFICATION
<% if flash.count.positive? %>
<script data-turbo-temporary>
document.addEventListener('turbo:load',(e)=>{
const common={
gravity: 'top',
position: 'center',
duration: 4000,
offset: { y: '1em' },
close: true
}
const notice={ className: 'toastify-notice', ...common }
const alert={ className: 'toastify-alert', ...common }
<% if flash.notice%>
Toastify({ text: '<%=flash.notice%>', ...notice}).showToast();
<%end%>
<% if flash.alert%>
Toastify({ text: '<%=flash.alert%>', ...alert}).showToast();
<%end%>
// useful to prevent flickering from turbo preview
Turbo.cache.exemptPageFromPreview()
}, {once: true})
</script>
<%end%>