Sha256: 3252798b03764c7eb9727f25f9c5d90c6f688e3a6a83830b5ad895d45dfcee9b

Contents?: true

Size: 937 Bytes

Versions: 1

Compression:

Stored size: 937 Bytes

Contents

module HomePage
  module ApplicationHelper
    # Taken from https://github.com/seyhunak/twitter-bootstrap-rails
    # Modified to support html in flash message
    def bootstrap_flash_raw
      flash_messages = []
      
      flash.each do |type, message|
        flash.delete(type)
        
        # Skip Devise :timeout and :timedout flags
        next if type == :timeout
        next if type == :timedout
        
        content =  type.to_s == "filter" ? "" : content_tag(:button, raw("×"), :class => "close", "data-dismiss" => "alert")
        type = :success if ["notice", "filter"].include? type.to_s
        type = :danger   if ["alert", "error", "recaptcha_error"].include? type.to_s
        content += raw(message)
        text = content_tag(:div, content, :class => "alert fade in alert-#{type}") 
        flash_messages << text if message
      end
      
      flash_messages.join("\n").html_safe
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
home_page-0.0.3 app/helpers/home_page/application_helper.rb