diff --git a/Gemfile b/Gemfile index b1c5764f..3b7e7f7a 100644 --- a/Gemfile +++ b/Gemfile @@ -48,6 +48,7 @@ gem 'omniauth-github' # as authorization framework gem 'cancancan' +gem 'toastr_rails' # for roles gem 'rolify' diff --git a/Gemfile.lock b/Gemfile.lock index e73c9b5e..36babd90 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -497,6 +497,7 @@ GEM timecop (0.7.1) timers (1.1.0) tins (1.6.0) + toastr_rails (2.1.3) transitions (0.1.12) ttfunk (1.1.1) turbolinks (2.5.3) @@ -628,6 +629,7 @@ 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 01cb83ee..397b1dc5 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 @@ -48,11 +49,28 @@ //= require countable $(document).ready(function() { - $('a[disabled=disabled]').click(function(event){ - return false; - }); + $('a[disabled=disabled]').click(function(event){ + return false; + }); - $('body').smoothScroll({ - delegateSelector: 'a.smoothscroll' - }); + toastr.options = { + 'closeButton': false, + 'debug': false, + 'newestOnTop': false, + 'progressBar': true, + 'positionClass': 'toast-top-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 2c5e4ebe..1acde96d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -133,21 +133,6 @@ module ApplicationHelper result end - def bootstrap_class_for(flash_type) - case flash_type - when 'success' - 'alert-success' - when 'error' - 'alert-danger' - when 'alert' - 'alert-warning' - when 'notice' - 'alert-info' - else - 'alert-warning' - end - end - def label_for(event_state) result = '' case event_state diff --git a/app/views/layouts/_messages.html.haml b/app/views/layouts/_messages.html.haml index 406087d7..c953d224 100644 --- a/app/views/layouts/_messages.html.haml +++ b/app/views/layouts/_messages.html.haml @@ -6,12 +6,4 @@ %h2 JavaScript is not enabled %p - OSEM requires JavaScript to be enabled to function. Please turn on JavaScript in your browser's settings and reload the page to continue. -- flash.each do |type, message| - .row - .col-md-12 - %div{:class=>"alert alert-dismissable #{bootstrap_class_for(type)}", :id=>"flash"} - .button.close{"data-dismiss" => "alert", "aria-hidden"=>"true"} - × - %p - = message \ No newline at end of file + OSEM requires JavaScript to be enabled to function. Please turn on JavaScript in your browser's settings and reload the page to continue. \ No newline at end of file diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 893198fa..bb9f04fd 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -18,10 +18,10 @@ }; = content_for(:script_head) = javascript_include_tag "//cdn.transifex.com/live.js" - = yield(:head) %body = render 'layouts/navigation' + = render 'toastr_rails/flash' -# Admin area - if controller.class.name.split("::").first=="Admin" = render 'layouts/admin'