Created
June 9, 2013 09:27
-
-
Save the-teacher/5742932 to your computer and use it in GitHub Desktop.
Rails flash messages + Twitter bootstrap + HAML + Coffee
This file contains hidden or 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
$ -> | |
$('.flash_msgs').on 'click', 'a.close', -> | |
$(@).parent().hide() |
This file contains hidden or 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
module ApplicationHelper | |
def flash_class(level) | |
case level | |
when :notice then "info" | |
when :error then "error" | |
when :alert then "warning" | |
end | |
end | |
end |
This file contains hidden or 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
- [:notice, :error, :alert].each do |level| | |
- unless flash[level].blank? | |
.alert.flash_msgs{ class: flash_class(level) } | |
%a.close × | |
= content_tag :p, flash[level] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment