From 40b99cc2d6646c52bf4748078d5308d9ed89e84b Mon Sep 17 00:00:00 2001 From: hitman Date: Tue, 7 Mar 2017 02:45:29 +0530 Subject: [PATCH] add toastr cdn and modified toast function --- Gemfile | 2 -- Gemfile.lock | 3 --- app/assets/javascripts/application.js | 19 ------------------- app/assets/stylesheets/application.css | 1 - app/helpers/application_helper.rb | 21 ++++++++++++++++++++- app/views/layouts/application.html.haml | 3 ++- 6 files changed, 22 insertions(+), 27 deletions(-) diff --git a/Gemfile b/Gemfile index 4e1a85d9..b1c5764f 100644 --- a/Gemfile +++ b/Gemfile @@ -20,8 +20,6 @@ gem 'responders', '~> 2.0' # as the database for Active Record gem 'mysql2' -# for toastr notifications -gem 'toastr-rails' # for observing records gem 'rails-observers' diff --git a/Gemfile.lock b/Gemfile.lock index 539589bd..b972eb0b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -497,8 +497,6 @@ GEM timecop (0.7.1) timers (1.1.0) tins (1.6.0) - toastr-rails (1.0.3) - railties (>= 3.1.0) transitions (0.1.12) ttfunk (1.1.1) turbolinks (2.5.3) @@ -630,7 +628,6 @@ DEPENDENCIES stripe stripe-ruby-mock timecop - toastr-rails transitions turbolinks uglifier (>= 1.3.0) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 0d341239..a3d05673 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -46,7 +46,6 @@ //= require unobtrusive_flash //= require unobtrusive_flash_bootstrap //= require countable -//= require toastr $(document).ready(function() { $('a[disabled=disabled]').click(function(event){ @@ -56,22 +55,4 @@ $(document).ready(function() { $('body').smoothScroll({ delegateSelector: 'a.smoothscroll' }); - - toastr.options = { - "closeButton": false, - "debug": false, - "newestOnTop": false, - "progressBar": true, - "positionClass": "toast-top-right", - "preventDuplicates": false, - "onclick": null, - "showDuration": "300", - "hideDuration": "1000", - "timeOut": "5000", - "extendedTimeOut": "1000", - "showEasing": "swing", - "hideEasing": "linear", - "showMethod": "fadeIn", - "hideMethod": "fadeOut" - } }); diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index da7d6276..ac01136f 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -15,5 +15,4 @@ *= require leaflet *= require bootstrap3-switch *= require osem-payments - *= require toastr */ diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d1136d3e..bd0935c7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -153,7 +153,26 @@ module ApplicationHelper flash.each do |type, message| type = 'success' if type == 'notice' type = 'error' if type == 'alert' - text = "" + text = "" flash_messages << text.html_safe if message end flash_messages.join("\n").html_safe diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index c2c29072..d043583b 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -6,6 +6,7 @@ %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 @@ -18,7 +19,7 @@ }; = 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'