|
4 | 4 | get '/.json', to: proc { [444, {}, ['']] }
|
5 | 5 | get '/teams/.json', to: proc { [444, {}, ['']] }
|
6 | 6 |
|
7 |
| - |
8 | 7 | if Rails.env.development?
|
9 | 8 | mount MailPreview => 'mail_view'
|
10 | 9 | end
|
11 | 10 |
|
12 |
| - #TODO: REMOVE |
| 11 | + namespace :api, path: '/', constraints: { subdomain: 'api' } do |
| 12 | + end |
| 13 | + |
| 14 | + # TODO: REMOVE |
13 | 15 | match 'protips/update', via: %w(get put)
|
14 | 16 | match 'protip/update' , via: %w(get put)
|
| 17 | + |
15 | 18 | get 'welcome' => 'home#index', as: :welcome
|
16 | 19 |
|
17 | 20 | root to: 'protips#index'
|
18 | 21 |
|
19 | 22 | get '/p/dpvbbg', controller: :protips, action: :show, id: 'devsal'
|
20 |
| - get '/gh' , controller: :protips, action: :show, utm_campaign: 'github_orgs_badges' , utm_source:'github' |
| 23 | + get '/gh' , controller: :protips, action: :show, utm_campaign: 'github_orgs_badges' , utm_source: 'github' |
21 | 24 |
|
22 | 25 | get '/jobs(/:location(/:skill))' => 'opportunities#index', as: :jobs
|
23 | 26 | get '/jobs-map' => 'opportunities#map', as: :jobs_map
|
24 | 27 |
|
25 |
| - resources :protips, :path => '/p' do |
| 28 | + resources :protips, path: '/p' do |
26 | 29 | collection do
|
27 | 30 | get 'u/:username' => 'protips#user', as: :user
|
28 |
| - get ':id/:slug' => 'protips#show', as: :slug, :constraints => {:slug => /(?!.*?edit).*/} |
| 31 | + get ':id/:slug' => 'protips#show', as: :slug, :constraints => { slug: /(?!.*?edit).*/ } |
29 | 32 | get 'random'
|
30 | 33 | get 'search' => 'protips#search', as: :search
|
31 | 34 | post 'search' => 'protips#search'
|
|
44 | 47 | get 'liked'
|
45 | 48 | post 'preview'
|
46 | 49 | end
|
| 50 | + |
47 | 51 | member do
|
48 | 52 | post 'upvote'
|
49 | 53 | post 'report_inappropriate'
|
|
53 | 57 | topic_regex = /[A-Za-z0-9#\$\+\-_\.(%23)(%24)(%2B)]+/
|
54 | 58 | post 'delete_tag/:topic' => 'protips#delete_tag', as: :delete_tag, :topic => topic_regex
|
55 | 59 | end
|
56 |
| - resources :comments, :constraints => {id: /\d+/} do |
| 60 | + resources :comments, constraints: { id: /\d+/ } do |
57 | 61 | member { post 'like' }
|
58 | 62 | end
|
59 | 63 | end
|
60 | 64 |
|
61 |
| - resources :networks, :path => '/n', :constraints => {:slug => /[\dA-Z\-]/i} do |
| 65 | + resources :networks, path: '/n', constraints: { slug: /[\dA-Z\-]/i } do |
62 | 66 | collection do
|
63 | 67 | get 'featured' => 'networks#featured', as: :featured
|
64 | 68 | get '/u/:username' => 'networks#user', as: :user
|
65 | 69 | end
|
| 70 | + |
66 | 71 | member do
|
67 | 72 | get '/t/(/*tags)' => 'networks#tag', as: :tagged
|
68 | 73 | get '/members' => 'networks#members', as: :members
|
|
108 | 113 | get '/alerts' => 'alerts#create', :via => :post
|
109 | 114 | get '/alerts' => 'alerts#index', :via => :get
|
110 | 115 |
|
111 |
| - #get '/payment' => 'accounts#new', as: :payment |
| 116 | + # get '/payment' => 'accounts#new', as: :payment |
112 | 117 |
|
113 | 118 | post '/users/:username/follow' => 'follows#create', as: :follow_user, :type => :user
|
114 | 119 |
|
|
121 | 126 | get 'accept'
|
122 | 127 | post 'record-exit' => 'teams#record_exit', as: :record_exit
|
123 | 128 | get 'visitors'
|
124 |
| - #TODO following and unfollowing should use different HTTP verbs (:post, :delete) |
| 129 | + # TODO following and unfollowing should use different HTTP verbs (:post, :delete) |
125 | 130 | # Fix views and specs when changing this.
|
126 | 131 | post 'follow'
|
127 | 132 | post 'join'
|
|
151 | 156 | get '/leaderboard' => 'teams#leaderboard', as: :leaderboard
|
152 | 157 | get '/employers' => 'teams#upgrade', as: :employers
|
153 | 158 |
|
154 |
| - ['github', 'twitter', 'forrst', 'dribbble', 'linkedin', 'codeplex', 'bitbucket', 'stackoverflow'].each do |provider| |
| 159 | + %w(github twitter forrst dribbble linkedin codeplex bitbucket stackoverflow).each do |provider| |
155 | 160 | post "/#{provider}/unlink" => 'users#unlink_provider', :provider => provider, as: "unlink_#{provider}".to_sym
|
156 | 161 | get "/#{provider}/:username" => 'users#show', :provider => provider
|
157 | 162 | end
|
|
179 | 184 | get '/nextaccomplishment' => 'highlights#random', as: :random_accomplishment
|
180 | 185 | get '/add-skill' => 'skills#create', as: :add_skill, :via => :post
|
181 | 186 |
|
182 |
| - |
183 | 187 | get '/blog' => 'blog_posts#index', as: :blog
|
184 | 188 | get '/blog/:id' => 'blog_posts#show', as: :blog_post
|
185 | 189 | get '/articles.atom' => 'blog_posts#index', as: :atom, :format => :atom
|
|
192 | 196 |
|
193 | 197 | get '/providers/:provider/:username' => 'provider_user_lookups#show'
|
194 | 198 |
|
195 |
| - match '/404' => 'errors#not_found', via: [ :get, :post, :patch, :delete ] |
196 |
| - match "/422" => "errors#unacceptable", via: [ :get, :post, :patch, :delete ] |
197 |
| - match "/500" => "errors#internal_error", via: [ :get, :post, :patch, :delete ] |
| 199 | + match '/404' => 'errors#not_found', via: [:get, :post, :patch, :delete] |
| 200 | + match '/422' => 'errors#unacceptable', via: [:get, :post, :patch, :delete] |
| 201 | + match '/500' => 'errors#internal_error', via: [:get, :post, :patch, :delete] |
198 | 202 |
|
199 | 203 | constraints ->(params, _) { params[:username] != 'admin' } do
|
200 | 204 | get '/:username' => 'users#show', as: :badge
|
|
210 | 214 | end
|
211 | 215 |
|
212 | 216 | require_admin = ->(_, req) { User.where(id: req.session[:current_user], admin: true).exists? }
|
213 |
| - scope :admin, as: :admin, :path => '/admin', :constraints => require_admin do |
| 217 | + scope :admin, as: :admin, path: '/admin', constraints: require_admin do |
214 | 218 | get '/' => 'admin#index', as: :root
|
215 | 219 | get '/teams' => 'admin#teams', as: :teams
|
216 | 220 | get '/teams/sections/:num_sections' => 'admin#sections_teams', as: :sections_teams
|
217 | 221 | get '/teams/section/:section' => 'admin#section_teams', as: :section_teams
|
218 | 222 | mount Sidekiq::Web => '/sidekiq'
|
219 | 223 | end
|
220 |
| - #TODO: namespace inside admin |
| 224 | + # TODO: namespace inside admin |
221 | 225 | get '/comments' => 'comments#index', as: :latest_comments
|
222 | 226 |
|
223 |
| - |
224 | 227 | end
|
225 | 228 |
|
226 | 229 | # == Route Map
|
|
0 commit comments