-
-
Save lgs/2784628 to your computer and use it in GitHub Desktop.
Flash Messages with Bootstrap 2 and Rails 3.2.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# in application_helper | |
def flash_class(level) | |
case level | |
when :notice then "alert alert-info" | |
when :success then "alert alert-success" | |
when :error then "alert alert-error" | |
when :alert then "alert alert-error" | |
end | |
end | |
# app/views/layouts/application.html.haml | |
= render "layouts/flash_messages" | |
# layouts/_flash_messages.haml | |
- flash.each do |type, message| | |
%div{:class => "fade in #{twitterized_type(type)}" } | |
%button{:class => 'close', 'data-dismiss' => 'alert'} × | |
= message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment