Sha256: f2f0834e8488a4caebbb3e8ab93372cafb97e2f2b9d8d6eed9feab685523fe83

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

module Para
  class Routes
    attr_reader :router

    def initialize(router)
      @router = router
    end

    def draw(mount_location = '/', &block)
      routes = self

      router.instance_eval do
        scope mount_location do
          scope module: :para do
            namespace :admin do
              get '/' => 'main#index'

              component :crud do
                scope ':model' do
                  resources :crud_resources, path: '/' do
                    collection do
                      patch :order
                      patch :tree
                      get :export
                    end

                    member do
                      post :clone
                    end
                  end
                end
              end

              component :singleton_resource, path: 'resource-form' do
                resource :singleton_resource, path: 'resource', only: [:create, :update]
              end

              component :settings do
                resource :settings_form, controller: 'settings_form', only: [:update]
              end
            end
          end

          block.call if block
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
para-0.4.0 lib/para/routes.rb