Sha256: 230a9a70f38373f6aca605acabaed7521db7a7e4095e3a2a41f2c06c4a69ca40

Contents?: true

Size: 1.31 KB

Versions: 18

Compression:

Stored size: 1.31 KB

Contents

require 'devise'

module ActiveAdmin
  module Devise

    def self.config
      config = {
        :path => ActiveAdmin.application.default_namespace,
        :controllers => ActiveAdmin::Devise.controllers,
        :path_names => { :sign_in => 'login', :sign_out => "logout" }
      }

      if ::Devise.respond_to?(:sign_out_via)
        logout_methods = [::Devise.sign_out_via, ActiveAdmin.application.logout_link_method].flatten.uniq
        config.merge!( :sign_out_via => logout_methods)
      end

      config
    end

    def self.controllers
      {
        :sessions => "active_admin/devise/sessions",
        :passwords => "active_admin/devise/passwords"
      }
    end

    module Controller
      extend ::ActiveSupport::Concern
      included do
        layout 'active_admin_logged_out'
        helper ::ActiveAdmin::ViewHelpers
      end

      # Redirect to the default namespace on logout
      def root_path
        if ActiveAdmin.application.default_namespace
          "/#{ActiveAdmin.application.default_namespace}"
        else
          "/"
        end
      end
    end

    class SessionsController < ::Devise::SessionsController
      include ::ActiveAdmin::Devise::Controller
    end

    class PasswordsController < ::Devise::PasswordsController
      include ::ActiveAdmin::Devise::Controller
    end

  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
activeadmin-0.5.0 lib/active_admin/devise.rb
activeadmin-0.5.0.pre1 lib/active_admin/devise.rb
activeadmin-0.5.0.pre lib/active_admin/devise.rb
activeadmin-0.4.4 lib/active_admin/devise.rb
activeadmin-0.4.3 lib/active_admin/devise.rb
activeadmin-0.4.2 lib/active_admin/devise.rb
activeadmin-0.4.1 lib/active_admin/devise.rb
activeadmin-0.4.0 lib/active_admin/devise.rb
andrewroth_activeadmin-0.3.4.4 lib/active_admin/devise.rb
andrewroth_activeadmin-0.3.4.3 lib/active_admin/devise.rb
andrewroth_activeadmin-0.3.4.2 lib/active_admin/devise.rb
andrewroth_activeadmin-0.3.4.1 lib/active_admin/devise.rb
andrewroth_activeadmin-0.3.4 lib/active_admin/devise.rb
activeadmin-0.3.4 lib/active_admin/devise.rb
activeadmin-0.3.3 lib/active_admin/devise.rb
activeadmin-0.3.2 lib/active_admin/devise.rb
activeadmin-0.3.1 lib/active_admin/devise.rb
activeadmin-0.3.0 lib/active_admin/devise.rb