Sha256: 4682df8699a947b367dcc121e24f69709884ab70d4920f9f33c1f799e8ab204a

Contents?: true

Size: 1.32 KB

Versions: 4

Compression:

Stored size: 1.32 KB

Contents

require_relative "../app/constraints/panda_cms/admin_constraint"

PandaCms::Engine.routes.draw do
  constraints PandaCms::AdminConstraint.new { |user| user.present? } do
    namespace PandaCms.admin_path_symbol.to_sym, as: :admin, module: :admin do
      resources :files
      resources :forms, only: %i[index show]
      resources :menus
      resources :pages do
        resources :block_contents, only: %i[update]
      end
      resources :posts

      get "settings", to: "settings#index"
      namespace :settings, as: :settings do
        get "bulk_editor", to: "bulk_editor#new"
        post "bulk_editor", to: "bulk_editor#create"
      end
    end

    get PandaCms.admin_path, to: "admin/dashboard#show", as: :admin_dashboard
  end

  ### PUBLIC ROUTES ###

  # Authentication routes
  get PandaCms.admin_path, to: "admin/sessions#new", as: :admin_login
  match "#{PandaCms.admin_path}/auth/:provider/callback", to: "admin/sessions#create", as: :admin_login_callback, via: %i[get post]
  delete PandaCms.admin_path, to: "admin/sessions#destroy", as: :admin_logout

  if PandaCms.posts
    # TODO: Allow multiple types of post in future
    get PandaCms.posts[:prefix], to: "posts#index", as: :posts
    get "#{PandaCms.posts[:prefix]}/:slug", to: "posts#show", as: :post
  end

  ### INHERITED ROUTES ###

  # See lib/panda_cms/engine.rb
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
panda_cms-0.3.10 config/routes.rb
panda_cms-0.3.9 config/routes.rb
panda_cms-0.3.8 config/routes.rb
panda_cms-0.3.7 config/routes.rb