UNPKG

550 BPlain TextView Raw
1module ApplicationHelper
2 def bootstrap_class_for flash_type
3 { success: "alert-success", error: "alert-danger", alert: "alert-warning", notice: "alert-info" }[flash_type.to_sym] || flash_type.to_s
4 end
5
6 def flash_messages(opts = {})
7 flash.each do |msg_type, message|
8 concat(content_tag(:div, message, class: "alert #{bootstrap_class_for(msg_type)} fade in") do
9 concat content_tag(:button, 'x'.html_safe, class: "close", data: { dismiss: 'alert' })
10 concat message
11 end)
12 end
13 nil
14 end
15end