Sha256: 0132e6990ea8b7c36cb949eb76dc4a793d275b5ceec3f84fef0b5396657d0a13

Contents?: true

Size: 704 Bytes

Versions: 8

Compression:

Stored size: 704 Bytes

Contents

require_dependency "application_controller"

module <%= project_class %>
  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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
express_admin-1.4.5 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb
express_admin-1.4.4 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb
express_admin-1.4.3 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb
express_admin-1.4.2 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb
express_admin-1.4.1 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb
express_admin-1.4.0 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb
express_admin-1.3.2 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb
express_admin-1.3.1 lib/generators/express_admin/install/templates/controllers/admin_controller.rb.erb