From 6b88403186616ab8068f6cc564fd605b7c4a8b93 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Thu, 26 Oct 2017 14:06:42 +0630 Subject: [PATCH] update notification --- app/assets/javascripts/custom.js | 1 + app/assets/javascripts/origami.js | 1 + app/controllers/base_origami_controller.rb | 3 ++- .../origami/cash_outs_controller.rb | 2 +- .../origami/paypar_payments_controller.rb | 2 +- app/controllers/origami/void_controller.rb | 2 +- app/views/layouts/origami.html.erb | 20 +++++++++++-------- 7 files changed, 19 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/custom.js b/app/assets/javascripts/custom.js index 0314e537..0fdec437 100644 --- a/app/assets/javascripts/custom.js +++ b/app/assets/javascripts/custom.js @@ -57,6 +57,7 @@ $(document).on('turbolinks:load', function() { var animateExit = $("#notify_message").attr('data-animate-exit'); var colorName = $("#notify_message").attr('data-color-name'); var text = $("#notify_message").attr('data-message'); + console.log(text); if (text != null || colorName != null){ showNotification(colorName, text, placementFrom, placementAlign, animateEnter, animateExit); } diff --git a/app/assets/javascripts/origami.js b/app/assets/javascripts/origami.js index c799c0be..c7212c81 100755 --- a/app/assets/javascripts/origami.js +++ b/app/assets/javascripts/origami.js @@ -6,6 +6,7 @@ //= require turbolinks //= require cable //= require jquery-slimscroll/jquery.slimscroll.js +//= require bootstrap-notify/bootstrap-notify.js //= require node-waves/waves.js //= require sweetalert/sweetalert.min.js //= require BSBMaterial/admin.js diff --git a/app/controllers/base_origami_controller.rb b/app/controllers/base_origami_controller.rb index 126b20b0..a3142197 100755 --- a/app/controllers/base_origami_controller.rb +++ b/app/controllers/base_origami_controller.rb @@ -4,9 +4,10 @@ class BaseOrigamiController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception - rescue_from CanCan::AccessDenied do |exception| flash[:warning] = exception.message + puts "ssssssssssss" + puts flash redirect_to origami_root_path end diff --git a/app/controllers/origami/cash_outs_controller.rb b/app/controllers/origami/cash_outs_controller.rb index 7f88f7e8..048e78b4 100755 --- a/app/controllers/origami/cash_outs_controller.rb +++ b/app/controllers/origami/cash_outs_controller.rb @@ -1,4 +1,4 @@ -class Origami::CashOutsController < ApplicationController#BaseOrigamiController +class Origami::CashOutsController < BaseOrigamiController def new end diff --git a/app/controllers/origami/paypar_payments_controller.rb b/app/controllers/origami/paypar_payments_controller.rb index 8f9cb59d..0c3ea11f 100755 --- a/app/controllers/origami/paypar_payments_controller.rb +++ b/app/controllers/origami/paypar_payments_controller.rb @@ -1,4 +1,4 @@ -class Origami::PayparPaymentsController < ApplicationController#BaseOrigamiController +class Origami::PayparPaymentsController < BaseOrigamiController def create sale_id = params[:sale_id] redeem_amount = params[:redeem_amount] diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index 15215279..1cf1ec65 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -1,4 +1,4 @@ -class Origami::VoidController < ApplicationController +class Origami::VoidController < BaseOrigamiController authorize_resource :class => false def overall_void diff --git a/app/views/layouts/origami.html.erb b/app/views/layouts/origami.html.erb index 1374cc8b..03fcfb1f 100755 --- a/app/views/layouts/origami.html.erb +++ b/app/views/layouts/origami.html.erb @@ -48,14 +48,18 @@
<% flash.each do |type, message| %> - <% if !flash["errors"]%> -
- - <%=message%> -
- <% end %> - - <% end %> + <% if type == "notice" + color = "alert-success" + elsif type == "error" + color = "alert-danger" + else + color = "bg-black" + end %> + + + <% end %> <%= yield %>