Saturday, 27 July 2013

Upgrading to Bootstrap 3 RC1 with Rails 4.0.0.rc1

#Add in application helper for bootstrap_flash
module ApplicationHelper
ALERT_TYPES = [:error, :info, :success, :warning]
def bootstrap_flash
flash_messages = []
flash.each do |type, message|
next if message.blank?
type = :success if type == :notice
type = :error if type == :alert
next unless ALERT_TYPES.include?(type)
Array(message).each do |msg|
text = content_tag(:div,
content_tag(:button, raw("×"), :class => "close", "data-dismiss" => "alert") +
msg.html_safe, :class => "alert fade in alert-#{type}")
flash_messages << text if msg
end
end
flash_messages.join("\n").html_safe
end
end
#Add to Gem file
gem "sass-rails", "~> 4.0.0"
gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails',
:github => 'anjlab/bootstrap-rails',
:branch => '3.0.0'
rake assets:precompile

No comments:

Post a Comment