Created
September 8, 2017 12:20
-
-
Save SunDi3yansyah/715ebe6dca755b1d1598caf11160209b to your computer and use it in GitHub Desktop.
Each :notice :error :alert helper
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
<% [:notice, :error, :alert].each do |level| %> | |
<% unless flash[level].blank? %> | |
<div data-alert="alert" class="alert alert-<%= flash_class(level) %> fade in"> | |
<a class="close" data-dismiss="alert" href="#">×</a> | |
<%= content_tag :p, flash[level] %> | |
</div> | |
<% 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
module ApplicationHelper | |
def flash_class(level) | |
case level | |
when :notice then 'info' | |
when :error then 'error' | |
when :alert then 'warning' | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment