Sha256: 5a35570994cb2463035edbe8e9fc6cfb55cfebd8a8107479482b1107d57cb45c

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

module RademadeAdmin
  module Routing
    module Mapper

      def admin_resources(*resources, &block)

        admin_resources = resources.dup
        options = admin_resources.extract_options!.dup

        admin_resources.each do |resource|
          resource_scope(:resources, Resource.new(resource, options)) do
            yield if block_given?

            parent_resource_actions = @scope[:scope_level_resource].actions

            collection do
              get :autocomplete
              patch :re_sort
            end

            new do
              get :form
            end if parent_resource_actions.include? :new

            member do
              get :form if parent_resource_actions.include? :edit
              patch :unlink_relation if parent_resource_actions.include? :update
              put :link_relation if parent_resource_actions.include? :update
            end

            Model::Graph.instance.add_pair(@scope[:controller], self.shallow?)

          end
        end

        resources(*resources, &block)

        self
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rademade_admin-0.0.1 lib/rademade_admin/routing/mapper.rb