诗歌rai之communityengine / config / desert_routes.rb

communityengine / config / desert_routes.rb 
Txt100755 159 lines (135 sloc) 7.727 kb
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#Forum routes go first
recent_forum_posts '/forums/recent', :controller => 'sb_posts', :action => 'index'
resources :forums, :sb_posts, :monitorship
resources :sb_posts, :name_prefix => 'all_', :collection => { :search => :get, :monitored => :get }

%w(forum).each do |attr|
  resources :sb_posts, :name_prefix => "#{attr}_", :path_prefix => "/#{attr.pluralize}/:#{attr}_id"
end

resources :forums do |forum|
  forum.resources :moderators
  forum.resources :topics do |topic|
    topic.resources :sb_posts
    topic.resource :monitorship, :controller => :monitorships
  end
end
forum_home '/forums', :controller => 'forums', :action => 'index'
resources :topics

connect 'sitemap.xml', :controller => "sitemap", :action => "index", :format => 'xml'
connect 'sitemap', :controller => "sitemap", :action => "index"

if AppConfig.closed_beta_mode
  connect '', :controller => "base", :action => "teaser"
  home 'home', :controller => "base", :action => "site_index"
else
  home '', :controller => "base", :action => "site_index"
end
application '', :controller => "base", :action => "site_index"

# Pages
resources :pages, :path_prefix => '/admin', :name_prefix => 'admin_', :except => :show, :member => { :preview => :get }
pages "pages/:id", :controller => 'pages', :action => 'show'

# admin routes

admin_dashboard '/admin/dashboard', :controller => 'homepage_features', :action => 'index'
admin_users '/admin/users', :controller => 'admin', :action => 'users'
admin_messages '/admin/messages', :controller => 'admin', :action => 'messages'
admin_comments '/admin/comments', :controller => 'admin', :action => 'comments'
admin_tags 'admin/tags/:action', :controller => 'tags', :defaults => {:action=>:manage}
admin_events 'admin/events', :controller => 'admin', :action=>'events'

# sessions routes
teaser '', :controller=>'base', :action=>'teaser'
login '/login', :controller => 'sessions', :action => 'new'
signup '/signup', :controller => 'users', :action => 'new'
logout '/logout', :controller => 'sessions', :action => 'destroy'
signup_by_id '/signup/:inviter_id/:inviter_code', :controller => 'users', :action => 'new'

forgot_password '/forgot_password', :controller => 'users', :action => 'forgot_password'
forgot_username '/forgot_username', :controller => 'users', :action => 'forgot_username'
resend_activation '/resend_activation', :controller => 'users', :action => 'resend_activation'

#clippings routes
connect '/new_clipping', :controller => 'clippings', :action => 'new_clipping'
site_clippings '/clippings', :controller => 'clippings', :action => 'site_index'
rss_site_clippings '/clippings.rss', :controller => 'clippings', :action => 'site_index', :format => 'rss'

featured '/featured', :controller => 'posts', :action => 'featured'
featured_rss '/featured.rss', :controller => 'posts', :action => 'featured', :format => 'rss'
popular '/popular', :controller => 'posts', :action => 'popular'
popular_rss '/popular.rss', :controller => 'posts', :action => 'popular', :format => 'rss'
recent '/recent', :controller => 'posts', :action => 'recent'
recent_rss '/recent.rss', :controller => 'posts', :action => 'recent', :format => 'rss'
rss_redirect '/rss', :controller => 'base', :action => 'rss_site_index'
rss '/site_index.rss', :controller => 'base', :action => 'site_index', :format => 'rss'

advertise '/advertise', :controller => 'base', :action => 'advertise'
css_help '/css_help', :controller => 'base', :action => 'css_help'
about '/about', :controller => 'base', :action => 'about'
faq '/faq', :controller => 'base', :action => 'faq'


edit_account_from_email '/account/edit', :controller => 'users', :action => 'edit_account'

friendships_xml '/friendships.xml', :controller => 'friendships', :action => 'index', :format => 'xml'
friendships '/friendships', :controller => 'friendships', :action => 'index'

manage_photos 'manage_photos', :controller => 'photos', :action => 'manage_photos'
create_photo 'create_photo.js', :controller => 'photos', :action => 'create', :format => 'js'

resources :sessions
resources :statistics, :collection => {:activities => :get, :activities_chart => :get}
resources :tags, :member_path => '/tags/:id'
show_tag_type '/tags/:id/:type', :controller => 'tags', :action => 'show'
search_tags '/search/tags', :controller => 'tags', :action => 'show'

resources :categories
resources :skills
resources :events, :collection => { :past => :get, :ical => :get }, :member => { :clone => :get } do |event|
  event.resources :rsvps, :except => [:index, :show]
end
resources :favorites, :path_prefix => '/:favoritable_type/:favoritable_id'
resources :comments, :path_prefix => '/:commentable_type/:commentable_id'
delete_selected_comments 'comments/delete_selected', :controller => "comments", :action => 'delete_selected'

resources :homepage_features
resources :metro_areas
resources :ads
resources :contests, :collection => { :current => :get }
resources :activities

resources :users, :member_path => '/:id', :nested_member_path => '/:user_id', :member => {
    :dashboard => :get,
    :assume => :get,
    :toggle_moderator => :put,
    :toggle_featured => :put,
    :change_profile_photo => :put,
    :return_admin => :get,
    :edit_account => :get,
    :update_account => :put,
    :edit_pro_details => :get,
    :update_pro_details => :put,
    :forgot_password => [:get, :post],
    :signup_completed => :get,
    :invite => :get,
    :welcome_photo => :get,
    :welcome_about => :get,
    :welcome_stylesheet => :get,
    :welcome_invite => :get,
    :welcome_complete => :get,
    :statistics => :any,
    :deactivate => :put,
    :crop_profile_photo => [:get, :put],
    :upload_profile_photo => [:get, :put]
     } do |user|
  user.resources :friendships, :member => { :accept => :put, :deny => :put }, :collection => { :accepted => :get, :pending => :get, :denied => :get }
  user.resources :photos, :collection => {:swfupload => :post, :slideshow => :get}
  user.resources :posts, :collection => {:manage => :get}, :member => {:contest => :get, :send_to_friend => :any, :update_views => :any}
  user.resources :events # Needed this to make comments work
  user.resources :clippings
  user.resources :activities, :collection => {:network => :get}
  user.resources :invitations
  user.resources :offerings, :collection => {:replace => :put}
  user.resources :favorites, :name_prefix => 'user_'
  user.resources :messages, :collection => { :delete_selected => :post, :auto_complete_for_username => :any }
  user.resources :comments
  user.resources :photo_manager, :only => ['index']
  user.resources :albums, :path_prefix => ':user_id/photo_manager', :member => {:add_photos => :get, :photos_added => :post}, :collection => {:paginate_photos => :get} do |album|
    album.resources :photos, :collection => {:swfupload => :post, :slideshow => :get}
  end
end
resources :votes
resources :invitations

users_posts_in_category '/users/:user_id/posts/category/:category_name', :controller => 'posts', :action => 'index', :category_name => :category_name

with_options(:controller => 'theme', :filename => /.*/, :conditions => {:method => :get}) do |theme|
  theme.connect 'stylesheets/theme/:filename', :action => 'stylesheets'
  theme.connect 'javascripts/theme/:filename', :action => 'javascript'
  theme.connect 'images/theme/:filename', :action => 'images'
end

# Deprecated routes
deprecated_popular_rss '/popular_rss', :controller => 'base', :action => 'popular', :format => 'rss'
deprecated_category_rss '/categories/:id;rss', :controller => 'categories', :action => 'show', :format => 'rss'
deprecated_posts_rss '/:user_id/posts;rss', :controller => 'posts', :action => 'index', :format => 'rss'

posted @ 2010-05-05 10:18  麦飞  阅读(238)  评论(0编辑  收藏  举报