Sha256: ed850f23857c8f26668706d1581d42006405ade35cce056a134dd84ec46c1556

Contents?: true

Size: 1.27 KB

Versions: 6

Compression:

Stored size: 1.27 KB

Contents

require "godmin/helpers/application"
require "godmin/helpers/forms"
require "godmin/helpers/navigation"
require "godmin/helpers/translations"

module Godmin
  module ApplicationController
    extend ActiveSupport::Concern

    included do
      include Godmin::Helpers::Translations

      helper Godmin::Helpers::Application
      helper Godmin::Helpers::Forms
      helper Godmin::Helpers::Navigation
      helper Godmin::Helpers::Translations

      helper_method :authentication_enabled?
      helper_method :authorization_enabled?
      helper_method :engine_wrapper

      before_action :append_view_paths

      layout "godmin/application"
    end

    def welcome; end

    protected

    private

    def engine_wrapper
      EngineWrapper.new(self.class)
    end

    def append_view_paths
      append_view_path Godmin::Resolver.resolvers(controller_path, engine_wrapper)
    end

    def disable_authentication
      @_disable_authentication = true
    end

    def disable_authorization
      @_disable_authorization = true
    end

    def authentication_enabled?
      !@_disable_authentication && singleton_class.include?(Godmin::Authentication)
    end

    def authorization_enabled?
      !@_disable_authorization && singleton_class.include?(Godmin::Authorization)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
godmin-2.3.0 lib/godmin/application_controller.rb
godmin-2.2.2 lib/godmin/application_controller.rb
godmin-2.2.1 lib/godmin/application_controller.rb
godmin-2.2.0 lib/godmin/application_controller.rb
godmin-2.1.0 lib/godmin/application_controller.rb
godmin-2.0.0 lib/godmin/application_controller.rb