Sha256: d77a2d737a5a360d9ba93629bad69c8f2a41afc766d02a567dcb23295d6c9246

Contents?: true

Size: 1.61 KB

Versions: 8

Compression:

Stored size: 1.61 KB

Contents

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

PandaCms::Engine.routes.draw do
  constraints PandaCms::AdminConstraint.new(&: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
  # Get and post options here are for OmniAuth coming back in, not going out
  match "#{PandaCms.admin_path}/auth/:provider/callback", to: "admin/sessions#create", as: :admin_login_callback, via: %i[get post]
  match "#{PandaCms.admin_path}/auth/failure", to: "admin/sessions#failure", as: :admin_login_failure, via: %i[get post]
  # OmniAuth additionally adds a GET route for "#{PandaCms.admin_path}/auth/:provider" but doesn't name it
  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

  ### APPENDED ROUTES ###

  # See lib/panda_cms/engine.rb
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
panda_cms-0.5.7 config/routes.rb
panda_cms-0.5.6 config/routes.rb
panda_cms-0.5.5 config/routes.rb
panda_cms-0.5.4 config/routes.rb
panda_cms-0.5.3 config/routes.rb
panda_cms-0.5.2 config/routes.rb
panda_cms-0.5.1 config/routes.rb
panda_cms-0.5.0 config/routes.rb