Module: FlashBlockHelper

Defined in:
app/helpers/flash_block_helper.rb

Instance Method Summary collapse

Instance Method Details

#bs_alert(type, message, options = {}) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/helpers/flash_block_helper.rb', line 14

def bs_alert(type, message, options={})
	alert_options = options.dup
	alert_options[:class] = parse_html_classes_to_arr alert_options[:class]
	alert_options[:class] << 'alert'
	alert_options[:class] << 'alert-dismissable'
	alert_options[:class] << alert_class(type)

	content = []
	content << (:button, '&times'.html_safe, class: 'close', type: 'button', data: {dismiss: :alert}, aria: {hidden: 'true'})
	content << message

	 :div, content.join("\n").html_safe, alert_options
end

#flash_block(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'app/helpers/flash_block_helper.rb', line 4

def flash_block(options={})
	content = []

	flash.each do |type, message|
		content << bs_alert(type, message)
	end

	 :div, content.join("\n").html_safe, options
end