Sha256: dcefd666e8ded8a68d4cd0d0363548e1d12d9e59e7f7d2192dbf1d9e1457dcb4
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
module BootstrapFlashMessages module Helpers def flash_messages(*args) if flash.present? block = args.include?(:block) show_heading = args.include?(:heading) show_close = args.include?(:close) unescape_html = args.include?(:html) simple_format = args.include?(:simple_format) fade = args.include?(:fade) messages = [] flash.each do |key, value| next if key == :timedout heading = "" if show_heading heading_text = I18n.t("flash_messages.headings.#{key}") heading = (block ? content_tag(:h4, heading_text, :class => "alert-heading") : content_tag(:strong, heading_text)) end close = "" if show_close close = content_tag(:button, raw("×"), :type => "button", :class => "close", "data-dismiss" => "alert", "aria-hidden" => "true") end value = simple_format(value) if simple_format value = raw(value) if unescape_html messages << content_tag(:div, close + heading + " " + value, :class => "alert alert-#{BootstrapFlashMessages.alert_class_mapping(key)}#{' alert-dismissable' if show_close}#{" fade in" if fade}") end raw(messages.join) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bootstrap_flash_messages-1.0.1 | lib/bootstrap_flash_messages/helpers.rb |
bootstrap_flash_messages-1.0.0 | lib/bootstrap_flash_messages/helpers.rb |