Last active
February 21, 2019 17:26
-
-
Save asssis/696244a6f901bb44c38fbf9a1afc9406 to your computer and use it in GitHub Desktop.
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
help_aplication | |
module ApplicationHelper | |
def flash_message | |
messages = "" | |
[:success, :warning, :danger].each {|type| | |
if flash[type] | |
if type == :success | |
messages = "<script type='text/javascript'> swal('Sucesso!', '#{flash[:success]}', 'success') </script>" | |
elsif type == :warning | |
messages = "<script type='text/javascript'> swal('Atenção!', '#{flash[:warning]}', 'warning') </script>" | |
elsif type == :danger | |
messages = "<script type='text/javascript'> swal('Falha!', '#{flash[:danger]}', 'error') </script>" | |
end | |
end | |
} | |
messages.html_safe | |
end | |
end | |
application | |
<%= flash_message %> | |
controle | |
flash[:danger] = 'Ação fiscal encerrada.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment