diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index a3d05673..79f6b5fc 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -11,6 +11,7 @@ // GO AFTER THE REQUIRES BELOW. // //= require jquery +//= require toastr_rails //= require jquery_ujs //= require jquery.mobile.custom.min //= require jquery.ui.draggable @@ -52,6 +53,23 @@ $(document).ready(function() { return false; }); + 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' + }; $('body').smoothScroll({ delegateSelector: 'a.smoothscroll' }); diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index ac01136f..93c4d2ae 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -15,4 +15,5 @@ *= require leaflet *= require bootstrap3-switch *= require osem-payments + *= require toastr_rails */ diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index bd0935c7..20c8eadb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -148,36 +148,6 @@ 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 = "" - flash_messages << text.html_safe if message - end - flash_messages.join("\n").html_safe - end - def label_for(event_state) result = '' case event_state diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index d043583b..bb9f04fd 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -6,7 +6,6 @@ %meta{:content => "", :name => "description"} %meta{:content => "", :name => "author"} = stylesheet_link_tag "application", :media => "all" - = stylesheet_link_tag "https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" = javascript_include_tag "application" = csrf_meta_tags @@ -19,11 +18,10 @@ }; = content_for(:script_head) = javascript_include_tag "//cdn.transifex.com/live.js" - = javascript_include_tag "https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js" = yield(:head) %body = render 'layouts/navigation' - = toast_bootstrap_flash + = render 'toastr_rails/flash' -# Admin area - if controller.class.name.split("::").first=="Admin" = render 'layouts/admin'