Sha256: d972d530cae5c10a8e15e86bd328df000c1f0703e42944e3bd237c5a8a8e73d9

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

include Adminpanel::RouterHelper

Adminpanel::Engine.routes.draw do

  Adminpanel.displayable_resources.each do |resource|
    case resource
    when :sections
      # sections cannot be created or destroyed
      resources :sections, resources_parameters(resource).merge(
      { except: [:new, :create, :destroy] }.merge(rest_path_names)
      )
    when :galleries
      # galleries gallery is different from normal resources galleries
      resources :galleries, resources_parameters(resource).merge(rest_path_names) do
        member do
          put :move_better, as: 'move_to_better', path: 'subir-prioridad'
          put :move_worst, as: 'move_to_worst', path: 'bajar-prioridad'
        end
      end
    when :analytics
      resources :analytics, resources_parameters(resource).merge(
        { only: [:index] }.merge(rest_path_names)
      )
    else
      if !get_gallery_children(resource).nil?
        # make the resources gallery routes
        resources get_gallery_children(resource).to_sym, only: [:index] do
          member do
            put :move_better, as: 'move_to_better', path: 'subir-prioridad'
            put :move_worst, as: 'move_to_worst', path: 'bajar-prioridad'
          end
        end
      end

      # normal resource
      resources resource, resources_parameters(resource).merge(rest_path_names)
    end
  end

  root to: "#{Adminpanel.displayable_resources.first}#index"
  resources :sessions, only: [:new, :create, :destroy]
  delete '/signout', to: 'sessions#destroy', as: 'signout', path: I18n.t('routes.signout')
  get '/signin', to: 'sessions#new', as: 'signin', path: I18n.t('routes.signin')
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
adminpanel-2.0.1 config/routes.rb