Sha256: b261ab637e05f5735f89dec09eb4debd69070d9245acb9f7a37e274ac29573eb

Contents?: true

Size: 780 Bytes

Versions: 3

Compression:

Stored size: 780 Bytes

Contents

module Admin

  class BaseController < ApplicationController
    layout 'admin'

    include Admin::PathHistory
    include Admin::ResourceHelpers
    extend Admin::SortableColumns

    helper_method :back_uri, :policy

    before_action :no_cache!
    before_action :authenticate_administrator!
    before_action :load_structure
    before_action :store_path_history
    before_action :action_enabled?

    def policy
      @policy ||= Coalla.policy.new(self)
    end

    delegate :sanitize_params, to: :policy

    protected

    def load_structure
      @structure = Coalla::AdminStructure.new(self, Rails.application.routes)
    end

    def action_enabled?
      redirect_to request.referer.presence || '/admin' unless policy.action_enabled?(action_name)
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
coalla-cms-0.7.0.0 app/controllers/admin/base_controller.rb
coalla-cms-0.6.1.1 app/controllers/admin/base_controller.rb
coalla-cms-0.6.0.9 app/controllers/admin/base_controller.rb