COUNT ||= 0 class NotificationController < ApplicationController def index logger.info 'index' end def show_notice flash.alert = %w[titi toto] if params[:multiple] == 'true' redirect_to notification_index_path, notice: 'this is a notice' end def show_alert flash.notice = ['italic message', 'normal message'] if params[:multiple] == 'true' redirect_to notification_index_path, alert: 'this is an alert' end def turbo_notice COUNT += 1 # TODO: render_stream (partial + flash -> flash.now + optional replace|append) flash.now[:notice] = "coucou ##{COUNT}" render turbo_stream: [ turbo_stream.replace(:flash, partial: 'layouts/components/flash') ] end def turbo_alert COUNT += 1 flash.now[:alert] = "alert, do the stuff right now ##{COUNT}" render turbo_stream: [ turbo_stream.replace(:flash, partial: 'layouts/components/flash') ] end def turbo_more COUNT += 1 flash.now[:alert] = "alert, do the stuff right now ##{COUNT}" flash.now[:notice] = ["this is extra notice ##{COUNT}", 'one more time'] render turbo_stream: [ turbo_stream.replace(:flash, partial: 'layouts/components/flash') ] end def turbo_none COUNT += 1 render turbo_stream: [ turbo_stream.replace(:flash, partial: 'layouts/components/flash') ] end end