-
-
Save kawahiro311/52d5f4ce0f7849454b32 to your computer and use it in GitHub Desktop.
RailsでTwitterBootstrapを使ったflashメッセージ
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.each do |type, message| %> | |
| <div class="alert <%= flash_class_for(type) %>" role="alert"> | |
| <button class="close" data-dismiss="alert">×</button> | |
| <%= message %> | |
| </div> | |
| <% 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
| <%= render partial: "shared/flashes", flash: flash %> |
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_for flash_type | |
| case flash_type | |
| when 'success' then 'alert-success' | |
| when 'error' then 'alert-danger' | |
| when 'alert' then 'alert-warning' | |
| when 'notice' then 'alert-info' | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment