Created
May 8, 2012 11:32
-
-
Save borgand/2634361 to your computer and use it in GitHub Desktop.
Rails HAML helper method to display Twitter Bootstrap alert boxes
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
module ApplicationHelper | |
# Display alert box with message or optional block | |
def alert_box(alert_type = :info) | |
haml_tag :div, :class => 'row-fluid' do | |
haml_tag :div, :class => "span9 alert alert-#{alert_type}" do | |
haml_tag :a, '×', :class => 'close', :'data-dismiss' => 'alert' | |
block_given? ? yield : msg | |
end | |
end | |
end | |
end |
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
- alert_box :info do | |
%strong Notice: | |
You can put what ever HAML in here. | |
%br | |
And even put in in multiple lines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment