Sha256: 3aba6ee24d279c9b6d18e8c96eef508e2608ce52e7fcdda694f0292e1fcd7fe2

Contents?: true

Size: 1.6 KB

Versions: 3

Compression:

Stored size: 1.6 KB

Contents

Rails.application.routes.draw do
  class PublicationConstraint
    def initialize; end
    def matches?(request)
      Publication.matching_slug(request.path.split('/')[-2]).count > 0 || Publication.matching_slug(request.path.split('/')[-1]).count > 0 || Publication.matching_slug(request.path.split('/')[-3]).count > 0
    end
  end

  class TestingConstraint
    def initialize; end
    def matches?(request)
      Rails.env == 'testing'
    end
  end

  constraints(TestingConstraint.new) do
    root :to => 'admin:publications#index', :via => :get
  end

  constraints(PublicationConstraint.new) do
    get ':publication_slug/', :to => 'publications#show'
    get ':publication_slug/feed', :to => 'publications#feed', :format => [:rss]
    get ':publication_slug/:content_slug/:section_slug', :to => 'sections#show'
    get ':publication_slug/:content_slug/:filename', :to => 'managed_contents#show'
    get '/:publication_slug/:content_slug', :to => 'managed_contents#show'
  end

  namespace :admin do
    put 'publications/:publication_id/managed_contents/reorder', :to => 'managed_contents#reorder', :as => 'publication_reorder_managed_contents'
    put 'publications/:publication_id/managed_contents/:managed_content_id/sections/reorder', :to => 'sections#reorder', :as => 'publication_managed_content_reorder_sections'
    resources :publications do
      resources :managed_contents do
        collection do
          get 'import'
          post 'upload'
        end
        resources :sections
      end
    end
  end

  resources :publications, :only => :show do
    resources :managed_contents, :only => :show
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
editorial_logic-1.1.4 config/routes.rb
editorial_logic-1.1.3 config/routes.rb
editorial_logic-1.1.2 config/routes.rb