Sha256: e8eca779248d03bdc51c01030280a8e3ea3aab0c646d6337c5efc23f030d9223
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 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) convert_newlines = args.include?(:convert_newlines) fade = args.include?(:fade) messages = [] flash.each do |key, value| 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 = link_to(raw("×"), "#", :class => "close", :data => { :dismiss => "alert" }) end value.gsub!("\n", "<br/>") if convert_newlines messages << content_tag(:div, :class => "alert alert-#{key}#{" alert-block" if block}#{" fade in" if fade}") do close + heading + " " + (unescape_html || convert_newlines ? raw(value) : value) end end raw(messages.join) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bootstrap_flash_messages-0.0.6 | lib/bootstrap_flash_messages/helpers.rb |