diff --git a/app/controllers/scores_controller.rb b/app/controllers/scores_controller.rb index 5ca0b43..6514923 100644 --- a/app/controllers/scores_controller.rb +++ b/app/controllers/scores_controller.rb @@ -42,8 +42,11 @@ class ScoresController < ApplicationController # DELETE /scores/1 def destroy - @score.destroy! - redirect_to scores_url, notice: 'Score was successfully destroyed.', status: :see_other + # @score.destroy! + # redirect_to scores_url, notice: 'Score was successfully destroyed.', status: :see_other + + flash.now[:alert] = "this is 'destroyed!'" + render turbo_stream: turbo_stream.replace('notification', partial: 'layouts/notification') end private diff --git a/app/views/layouts/_coucou.html.erb b/app/views/layouts/_coucou.html.erb new file mode 100644 index 0000000..cd5c884 --- /dev/null +++ b/app/views/layouts/_coucou.html.erb @@ -0,0 +1,3 @@ +NOTIFICATION + +COUCOU \ No newline at end of file diff --git a/app/views/layouts/_notification.html.erb b/app/views/layouts/_notification.html.erb index 4edb1bb..cda0640 100644 --- a/app/views/layouts/_notification.html.erb +++ b/app/views/layouts/_notification.html.erb @@ -1,28 +1,35 @@ -<% if flash.count.positive? %> - -<%end%> + if (notice.length>0){ + console.info(`TOAST notice: ${notice}`) + Toastify({ text: notice, ...noticeOptions }).showToast(); + notice='' + } + if (alert.length>0){ + console.warn(`TOAST alert: ${alert}`) + Toastify({ text: alert, ...alertOptions }).showToast(); + alert='' + } + + <% end %> +<% end %>