add toastr cdn and modified toast function
This commit is contained in:
parent
5e3e482311
commit
40b99cc2d6
6 changed files with 22 additions and 27 deletions
2
Gemfile
2
Gemfile
|
|
@ -20,8 +20,6 @@ gem 'responders', '~> 2.0'
|
||||||
# as the database for Active Record
|
# as the database for Active Record
|
||||||
gem 'mysql2'
|
gem 'mysql2'
|
||||||
|
|
||||||
# for toastr notifications
|
|
||||||
gem 'toastr-rails'
|
|
||||||
# for observing records
|
# for observing records
|
||||||
gem 'rails-observers'
|
gem 'rails-observers'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -497,8 +497,6 @@ GEM
|
||||||
timecop (0.7.1)
|
timecop (0.7.1)
|
||||||
timers (1.1.0)
|
timers (1.1.0)
|
||||||
tins (1.6.0)
|
tins (1.6.0)
|
||||||
toastr-rails (1.0.3)
|
|
||||||
railties (>= 3.1.0)
|
|
||||||
transitions (0.1.12)
|
transitions (0.1.12)
|
||||||
ttfunk (1.1.1)
|
ttfunk (1.1.1)
|
||||||
turbolinks (2.5.3)
|
turbolinks (2.5.3)
|
||||||
|
|
@ -630,7 +628,6 @@ DEPENDENCIES
|
||||||
stripe
|
stripe
|
||||||
stripe-ruby-mock
|
stripe-ruby-mock
|
||||||
timecop
|
timecop
|
||||||
toastr-rails
|
|
||||||
transitions
|
transitions
|
||||||
turbolinks
|
turbolinks
|
||||||
uglifier (>= 1.3.0)
|
uglifier (>= 1.3.0)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@
|
||||||
//= require unobtrusive_flash
|
//= require unobtrusive_flash
|
||||||
//= require unobtrusive_flash_bootstrap
|
//= require unobtrusive_flash_bootstrap
|
||||||
//= require countable
|
//= require countable
|
||||||
//= require toastr
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('a[disabled=disabled]').click(function(event){
|
$('a[disabled=disabled]').click(function(event){
|
||||||
|
|
@ -56,22 +55,4 @@ $(document).ready(function() {
|
||||||
$('body').smoothScroll({
|
$('body').smoothScroll({
|
||||||
delegateSelector: 'a.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"
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,4 @@
|
||||||
*= require leaflet
|
*= require leaflet
|
||||||
*= require bootstrap3-switch
|
*= require bootstrap3-switch
|
||||||
*= require osem-payments
|
*= require osem-payments
|
||||||
*= require toastr
|
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,26 @@ module ApplicationHelper
|
||||||
flash.each do |type, message|
|
flash.each do |type, message|
|
||||||
type = 'success' if type == 'notice'
|
type = 'success' if type == 'notice'
|
||||||
type = 'error' if type == 'alert'
|
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
|
flash_messages << text.html_safe if message
|
||||||
end
|
end
|
||||||
flash_messages.join("\n").html_safe
|
flash_messages.join("\n").html_safe
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
%meta{:content => "", :name => "description"}
|
%meta{:content => "", :name => "description"}
|
||||||
%meta{:content => "", :name => "author"}
|
%meta{:content => "", :name => "author"}
|
||||||
= stylesheet_link_tag "application", :media => "all"
|
= 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"
|
= javascript_include_tag "application"
|
||||||
|
|
||||||
= csrf_meta_tags
|
= csrf_meta_tags
|
||||||
|
|
@ -18,7 +19,7 @@
|
||||||
};
|
};
|
||||||
= content_for(:script_head)
|
= content_for(:script_head)
|
||||||
= javascript_include_tag "//cdn.transifex.com/live.js"
|
= 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)
|
= yield(:head)
|
||||||
%body
|
%body
|
||||||
= render 'layouts/navigation'
|
= render 'layouts/navigation'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue