aboutsummaryrefslogtreecommitdiffstats
path: root/config/routes.rb
blob: 70406dec66a74f21cb363a7d1e248982ba3a1531 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
if Rails.version < '3.0.0'
  ActionController::Routing::Routes.draw do |map|
    map.blog_post '/blog', :controller => :blog_posts, :action => :index
    map.blog_post '/blog/:id', :controller => :blog_posts, :action => :show
    map.blog_category '/blog/categories/:category_id', :controller => :blog_posts, :action => :index
    map.blog_post_blog_comments '/blog/:id/comments', :controller => :blog_posts, :action => :comment

    map.namespace(:admin, :path_prefix => 'refinery') do |admin|
      admin.namespace :blog do |blog|
        blog.resources :posts

        blog.resources :categories

        blog.resources :comments, :collection => {
          :approved => :get,
          :rejected => :get
        }, :member => {
          :approved => :get,
          :rejected => :get
        }

        blog.resources :settings, :collection => {
          :notification_recipients => [:get, :post],
          :moderation => :get
        }
      end
    end
  end
else
  Refinery::Application.routes.draw do
    match '/blog',      :to => 'blog_posts#index',    :as => 'blog_post'
    match '/blog/:id',  :to => 'blog_posts#show',     :as => 'blog_post'

    match '/blog/categories/:category_id', :to => 'blog_posts#index',   :as => 'blog_category'
    match '/blog/:id/comments',            :to => 'blog_posts#comment', :as => 'blog_post_blog_comments'

    scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
      scope(:path => 'blog', :name_prefix => 'admin', :as => 'blog', :module => 'blog') do
        root :to => 'posts#index'
        resources :posts

        resources :categories

        resources :comments do
          collection do
            get :approved
            get :rejected
          end
          member do
            get :approved
            get :rejected
          end
        end

        resources :settings do
          collection do
            get :notification_recipients
            post :notification_recipients

            get :moderation
          end
        end
      end
    end
  end
end