Created
April 15, 2010 19:30
-
-
Save damien/367530 to your computer and use it in GitHub Desktop.
A simple helper method/view to display flash notices and alerts. The application this code is extracted from utilized José Valim's excellant Responders gem to display localized messages.
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
%div.alert= flash[:alert] |
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
%div.notice= flash[:notice] |
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
!!! | |
%html | |
%head | |
%title | |
Scanlatr: | |
= controller.controller_name.capitalize | |
= controller.action_name.capitalize | |
= csrf_meta_tag | |
= stylesheet_link_tag 'compiled/screen.css', :media => 'screen, projection' | |
= stylesheet_link_tag 'compiled/print.css', :media => 'print' | |
/[if lt IE 8] | |
= stylesheet_link_tag 'compiled/ie.css', :media => 'screen, projection' | |
= javascript_include_tag :defaults | |
%body.bp | |
= render_flash_messages | |
= yield |
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 render_flash_messages | |
if flash[:notice] | |
render :partial => 'shared/flash_notice', :object => flash[:notice] | |
end | |
if flash[:alert] | |
render :partial => 'shared/flash_alert', :object => flash[:alert] | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment