admin_controller.rb 651 Bytes
require 'unobtrusive_flash'

module Kanjai
  class AdminController < ApplicationController
    include UnobtrusiveFlash::ControllerMixin

    helper :all

    layout 'kanjai/admin'

    protect_from_forgery

    before_action :authenticate_admin_user!
    before_action :set_locale
    before_action :set_cache_headers

    after_action :prepare_unobtrusive_flash

    private

    def set_locale
      I18n.locale = :en
    end

    def set_cache_headers
      response.headers["Cache-Control"] = "no-cache, no-store"
      response.headers["Pragma"] = "no-cache"
      response.headers["Expires"] = "Mon, 01 Jan 1990 00:00:00 GMT"
    end

  end
end