Sha256: 742abe3574a48b426b86d9ca4969d5a913290edfb0e5f753c836f9147068b200

Contents?: true

Size: 767 Bytes

Versions: 3

Compression:

Stored size: 767 Bytes

Contents

require_dependency "application_controller"

module <%= project_class %>
  module Admin
    class AdminController < ApplicationController
      inherit_resources  # Use inherited_resources

      helper ::ExpressAdmin::AdminHelper
      before_filter :authenticate_user! if defined?(Devise)
      layout "<%= project_name %>/admin"

      before_filter :load_collection, only: [:show]
      before_filter :build_new_resource, only: [:index]

      def show
        show! do |format|
          format.html { render :index }
        end
      end

      private

        def load_collection
          collection # from InheritedResources
        end

        def build_new_resource
          @resource_params = {}
          build_resource
        end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
express_admin-1.3.0 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb
express_admin-1.2.1 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb
express_admin-1.2.0 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb