From 1abd5a06ffd332d7e08f6c2708197d23a070a7de Mon Sep 17 00:00:00 2001 From: pvincent Date: Mon, 29 Jan 2024 16:11:58 +0400 Subject: [PATCH] notyf OK --- app/javascript/application.js | 12 ++++++++- app/views/layouts/_notification.html.erb | 32 +++++++----------------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/app/javascript/application.js b/app/javascript/application.js index 7c48bbd..65e1c18 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,6 +1,16 @@ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails import "@hotwired/turbo-rails" import "controllers" +import { Notyf } from 'notyf' + +window.buildNotyf = ()=>{ + const notyf=new Notyf({ + duration: 5000, + position: { x: 'center', y: 'top' }, + }) + return notyf +} // Customize Turbo default behaviour -Turbo.setProgressBarDelay(300) \ No newline at end of file +Turbo.setProgressBarDelay(300) +// Turbo.session.drive = false \ No newline at end of file diff --git a/app/views/layouts/_notification.html.erb b/app/views/layouts/_notification.html.erb index 80feae8..d5db2e7 100644 --- a/app/views/layouts/_notification.html.erb +++ b/app/views/layouts/_notification.html.erb @@ -1,27 +1,13 @@

NOTIFICATION BAR

+ -<%end%> + }, {once: true}) +