Sha256: be27a080720d2ecc96d0424fd7556b013c60ca89864a2f040626b961346c8d14

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

PagesCms::Engine.routes.draw do

  resources :articles,    only: [:show]
  resources :contacts,    only: [:create]

  namespace :admin do
    resources :pages,     except: [:show, :new]
    resources :images,    only:   [:create, :index, :destroy]
    resources :documents, only:   [:create, :index, :destroy]
    resources :articles,  only:   [:index, :create, :update, :destroy]
    resources :contacts,  only:   [:index, :destroy]
    resources :accounts,  except: [:show]
    post '/pages/order'   => 'pages#order'
    post '/accounts/site' => 'accounts#site'
  end
  begin
    if PagesCms.const_defined?('Account')
      accounts = PagesCms::Account.where("mount_location != '/'")
      raccount = PagesCms::Account.find_by(mount_location: '/')
      if accounts
        accounts.each do |account|
          get "/#{account.mount_location}/:parent/:slug"  => 'pages#show', account: account.id
          get "/#{account.mount_location}/:slug"          => 'pages#show', account: account.id
          get "/#{account.mount_location}/"               => 'pages#home', account: account.id
        end
      end
      if raccount
        get '/:parent/:slug'  => 'pages#show', account: raccount.id, root: true
        get '/:slug'          => 'pages#show', account: raccount.id, root: true
        get '/'               => 'pages#home', account: raccount.id, root: true, as: :root
      end
    end
  rescue Exception => e
    nil
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pages_cms-2.3.2 config/routes.rb