Sha256: fd94afa7ae672838f45692f641b1410dd36ecfb74000b2f950b4bb76299e596e
Contents?: true
Size: 913 Bytes
Versions: 20
Compression:
Stored size: 913 Bytes
Contents
# = bootstrap_flash module BootstrapFlashHelper ALERT_TYPES = [:success, :info, :warning, :danger] unless const_defined?(:ALERT_TYPES) def bootstrap_flash(options = {}) flash_messages = [] flash.each do |type, message| # Skip empty messages, e.g. for devise messages set to nothing in a locale file. next if message.blank? type = type.to_sym type = :success if type == :notice type = :danger if type == :alert type = :danger if type == :error next unless ALERT_TYPES.include?(type) Array(message).each do |msg| text = content_tag(:div, content_tag(:button, raw("×"), class: "close", "data-dismiss" => "alert") + msg, class: "alert fade in alert-#{type} #{options[:class]}") flash_messages << text if msg end end flash_messages.join("\n").html_safe end end
Version data entries
20 entries across 20 versions & 1 rubygems