add action base and update base ctrls

This commit is contained in:
Yan
2018-02-26 17:42:54 +06:30
parent 07e208a457
commit 13b7b1f800
9 changed files with 100 additions and 23 deletions

View File

@@ -1,11 +1,11 @@
class ApplicationController < ActionController::Base
include LicenseVerification
include LoginVerification
#before_action :check_installation
protect_from_forgery with: :exception
# lookup domain for db from provision
before_action :set_locale
# before_action :set_locale
helper_method :current_company,:current_login_employee,:current_user
# alias_method :current_user, :current_login_employee,:current_user
@@ -13,16 +13,6 @@ class ApplicationController < ActionController::Base
#all token authentication must be done here
#response format must be set to JSON
#change locallization
def set_locale
I18n.locale = params[:locale] || I18n.default_locale
end
# RESTful url for localize
def default_url_options
{ locale: I18n.locale }
end
rescue_from CanCan::AccessDenied do |exception|
flash[:warning] = exception.message
redirect_to root_path

View File

@@ -1,4 +1,5 @@
class BaseCrmController < ApplicationController
class BaseCrmController < ActionController::Base
include LoginVerification
layout "CRM"
#before_action :check_installation

View File

@@ -1,4 +1,5 @@
class BaseInventoryController < ApplicationController
class BaseInventoryController < ActionController::Base
include LoginVerification
layout "inventory"
#before_action :check_installation

View File

@@ -1,4 +1,5 @@
class BaseOqsController < ApplicationController
class BaseOqsController < ActionController::Base
include LoginVerification
layout "OQS"
#before_action :check_installation

View File

@@ -1,4 +1,5 @@
class BaseOrigamiController < ApplicationController
class BaseOrigamiController < ActionController::Base
include LoginVerification
layout "origami"
# before_action :checkin_process

View File

@@ -1,10 +1,11 @@
class BaseReportController < ApplicationController
layout "application"
class BaseReportController < ActionController::Base
include LoginVerification
layout "application"
#before_action :check_installation
protect_from_forgery with: :exception
#before_action :check_installation
protect_from_forgery with: :exception
rescue_from CanCan::AccessDenied do |exception|
rescue_from CanCan::AccessDenied do |exception|
flash[:warning] = exception.message
redirect_to root_path
end

View File

@@ -1,4 +1,5 @@
class BaseWaiterController < ApplicationController
class BaseWaiterController < ActionController::Base
include LoginVerification
layout "waiter"
#before_action :check_installation

View File

@@ -2,7 +2,7 @@ module LoginVerification
extend ActiveSupport::Concern
included do
before_action :authenticate_session_token
before_action :authenticate
helper_method :current_company,:current_login_employee
end