Sha256: e3a2df782b6fdfaa97a9636e4ed126a91f16c982638956621b50eacb91f5d8aa

Contents?: true

Size: 1.07 KB

Versions: 21

Compression:

Stored size: 1.07 KB

Contents

EffectivePosts::Engine.routes.draw do
  namespace :admin do
    resources :posts, except: [:show]

    if EffectivePosts.submissions_enabled && EffectivePosts.submissions_require_approval
      match 'posts/:id/approve', to: 'posts#approve', via: :get, as: :approve_post
    end

    match 'posts/excerpts', to: 'posts#excerpts', via: :get
  end

  scope :module => 'effective' do
    resources :posts, only: ([:index, :show] unless EffectivePosts.submissions_enabled)

    if EffectivePosts.use_category_routes
      Array(EffectivePosts.categories).map { |category| category.to_s }.each do |category|
        next if category == 'posts'

        match category, to: 'posts#index', via: :get, defaults: {:category => category }
        match "#{category}/:id", to: 'posts#show', via: :get, defaults: {:category => category }
      end
    end
  end

end

# Automatically mount the engine as an append
Rails.application.routes.append do
  unless Rails.application.routes.routes.find { |r| r.name == 'effective_posts' }
    mount EffectivePosts::Engine => '/', :as => 'effective_posts'
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
effective_posts-0.7.1 config/routes.rb
effective_posts-0.7.0 config/routes.rb
effective_posts-0.6.4 config/routes.rb
effective_posts-0.6.3 config/routes.rb
effective_posts-0.6.2 config/routes.rb
effective_posts-0.6.1 config/routes.rb
effective_posts-0.6.0 config/routes.rb
effective_posts-1.0.2 config/routes.rb
effective_posts-1.0.1 config/routes.rb
effective_posts-0.5.10 config/routes.rb
effective_posts-1.0.0 config/routes.rb
effective_posts-0.5.8 config/routes.rb
effective_posts-0.5.7 config/routes.rb
effective_posts-0.5.6 config/routes.rb
effective_posts-0.5.5 config/routes.rb
effective_posts-0.5.4 config/routes.rb
effective_posts-0.5.3 config/routes.rb
effective_posts-0.5.2 config/routes.rb
effective_posts-0.5.1 config/routes.rb
effective_posts-0.5.0 config/routes.rb