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.
47 lines
1.3 KiB
47 lines
1.3 KiB
class NotificationController < ApplicationController
|
|
def 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 = ['<i>italic</i> <b>message</b>', 'normal <b>message</b>'] if params[:multiple] == 'true'
|
|
redirect_to notification_index_path, alert: 'this is an alert'
|
|
end
|
|
|
|
def turbo_notice
|
|
render_stream notice: "my notice ##{inc_count}" do |stream|
|
|
stream.replace :turbo_placeholder, partial: 'turbo_placeholder'
|
|
end
|
|
end
|
|
|
|
def turbo_alert
|
|
render_stream alert: "alert, do the stuff right now ##{inc_count}" do |stream|
|
|
stream.replace :turbo_placeholder2, partial: 'turbo_placeholder2'
|
|
end
|
|
end
|
|
|
|
def turbo_more
|
|
flash.now[:alert] = "alert, do the stuff right now ##{inc_count}"
|
|
flash.now[:notice] = ["this is extra notice ##{inc_count}", 'one more time']
|
|
render_stream do |stream|
|
|
[
|
|
stream.replace(:turbo_placeholder, partial: 'turbo_placeholder'),
|
|
stream.replace(:turbo_placeholder2, partial: 'turbo_placeholder2')
|
|
]
|
|
end
|
|
end
|
|
|
|
def turbo_none
|
|
render_stream
|
|
end
|
|
|
|
private
|
|
|
|
def inc_count
|
|
@@count ||= 0 # rubocop:disable Style/ClassVars
|
|
@@count += 1 # rubocop:disable Style/ClassVars
|
|
end
|
|
end
|