2017-04-11 04:27:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Admin
|
|
|
|
class BaseController < ApplicationController
|
2017-11-12 04:23:33 +09:00
|
|
|
include Authorization
|
2017-11-24 10:05:53 +09:00
|
|
|
include AccountableConcern
|
2017-11-12 04:23:33 +09:00
|
|
|
|
2017-11-21 15:13:37 +09:00
|
|
|
layout 'admin'
|
|
|
|
|
|
|
|
before_action :set_pack
|
2018-10-25 07:10:01 +09:00
|
|
|
before_action :set_body_classes
|
2023-04-19 23:07:29 +09:00
|
|
|
before_action :set_cache_headers
|
|
|
|
|
2022-07-05 09:41:40 +09:00
|
|
|
after_action :verify_authorized
|
2017-04-11 04:27:03 +09:00
|
|
|
|
2018-10-25 07:10:01 +09:00
|
|
|
private
|
|
|
|
|
|
|
|
def set_body_classes
|
|
|
|
@body_classes = 'admin'
|
|
|
|
end
|
2017-04-11 04:27:03 +09:00
|
|
|
|
2017-11-21 15:13:37 +09:00
|
|
|
def set_pack
|
|
|
|
use_pack 'admin'
|
|
|
|
end
|
2018-12-19 00:55:15 +09:00
|
|
|
|
2023-04-19 23:07:29 +09:00
|
|
|
def set_cache_headers
|
|
|
|
response.cache_control.replace(private: true, no_store: true)
|
|
|
|
end
|
|
|
|
|
2018-12-17 19:40:51 +09:00
|
|
|
def set_user
|
|
|
|
@user = Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
|
|
|
|
end
|
2017-04-11 04:27:03 +09:00
|
|
|
end
|
|
|
|
end
|