Sha256: 9450bb441e471a034772ad6cd1c1316a8b2a90419e63e56254d8022ef82929dd

Contents?: true

Size: 1.45 KB

Versions: 7

Compression:

Stored size: 1.45 KB

Contents

Rails.application.routes.draw do
  root :to => 'admin:publications#index', :via => :get if Rails.env.test?

  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

  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

7 entries across 7 versions & 1 rubygems

Version Path
editorial_logic-1.4.0 config/routes.rb
editorial_logic-1.3.3 config/routes.rb
editorial_logic-1.3.2 config/routes.rb
editorial_logic-1.3.1 config/routes.rb
editorial_logic-1.3.0 config/routes.rb
editorial_logic-1.1.6 config/routes.rb
editorial_logic-1.1.5 config/routes.rb