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
780 B
28 lines
780 B
<% 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 text-black', ...common }
|
|
const alert={ className: 'text-black 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%>
|