Sha256: 852831d6a8f016ef59354e42943caa9ce49793126c4ac9fcb94dbaab296fe691

Contents?: true

Size: 599 Bytes

Versions: 2

Compression:

Stored size: 599 Bytes

Contents

module BootstrapFlashHelper
  def bootstrap_flash
    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 = :success if type == :notice
      type = :error   if type == :alert
      text = content_tag(:div,
               content_tag(:button, raw("×"), :class => "close", "data-dismiss" => "alert") +
               message, :class => "alert fade in alert-#{type}")
      flash_messages << text if message
    end
    flash_messages.join("\n").html_safe
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twitter-bootstrap-rails-2.2.3 app/helpers/bootstrap_flash_helper.rb
twitter-bootstrap-rails-2.2.1 app/helpers/bootstrap_flash_helper.rb