Sha256: 2551ab43116f77fcdf8967a6466b7b28304d14cfa77058c65f1d75c8d5a56a01
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
module RailsDb module FlashMessagesHelper # <div class="alert-box [success alert secondary]"> # This is an alert box. # <a href="" class="close">×</a> # </div> DEFAULT_KEY_MATCHING = { :alert => :alert, :notice => :success, :info => :info, :secondary => :secondary, :success => :success, :error => :alert, :warning => :warning } def display_flash_messages(key_matching = {}) key_matching = DEFAULT_KEY_MATCHING.merge(key_matching) key_matching.default = :standard result = capture do flash.each do |key, value| alert_class = key_matching[key.to_sym] concat alert_box(value, alert_class) end end flash.clear result end private def alert_box(value, alert_class) content_tag :div, :data => { :alert => "" }, :class => "alert-box #{alert_class}" do concat value concat close_link end end def close_link link_to("×".html_safe, "#", :class => :close) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rails_db-0.3 | app/helpers/rails_db/flash_messages_helper.rb |
rails_db-0.2.1 | app/helpers/rails_db/flash_messages_helper.rb |
rails_db-0.2 | app/helpers/rails_db/flash_messages_helper.rb |