add toastr for notifications

This commit is contained in:
hitman 2017-03-06 22:04:09 +05:30
parent b46a721a7d
commit 5e3e482311
6 changed files with 44 additions and 7 deletions

View file

@ -148,6 +148,17 @@ module ApplicationHelper
end
end
def toast_bootstrap_flash
flash_messages = []
flash.each do |type, message|
type = 'success' if type == 'notice'
type = 'error' if type == 'alert'
text = "<script>toastr.#{type}('#{message}');</script>"
flash_messages << text.html_safe if message
end
flash_messages.join("\n").html_safe
end
def label_for(event_state)
result = ''
case event_state