add toastr cdn and modified toast function

This commit is contained in:
hitman 2017-03-07 02:45:29 +05:30
parent 5e3e482311
commit 40b99cc2d6
6 changed files with 22 additions and 27 deletions

View file

@ -153,7 +153,26 @@ module ApplicationHelper
flash.each do |type, message|
type = 'success' if type == 'notice'
type = 'error' if type == 'alert'
text = "<script>toastr.#{type}('#{message}');</script>"
text = "<script>
toastr.options = {
'closeButton': false,
'debug': false,
'newestOnTop': false,
'progressBar': true,
'positionClass': 'toast-bottom-center',
'preventDuplicates': true,
'onclick': null,
'showDuration': '300',
'hideDuration': '100',
'timeOut': '5000',
'extendedTimeOut': '1000',
'showEasing': 'swing',
'hideEasing': 'linear',
'showMethod': 'fadeIn',
'hideMethod': 'fadeOut'
};
toastr.#{type}('#{message}');
</script>"
flash_messages << text.html_safe if message
end
flash_messages.join("\n").html_safe