diff options
author | Long Nguyen <long.polyglot@gmail.com> | 2016-05-08 11:27:33 +0300 |
---|---|---|
committer | Long Nguyen <long.polyglot@gmail.com> | 2016-05-08 11:27:33 +0300 |
commit | ffda8a1a0eb273e62fcb0197f352400946571778 (patch) | |
tree | be1465d224f13c603d0ee80f12dcb0f161bea0d7 /config | |
parent | 5f60841d7e4aea2b6298df7ea0423e3baa769df1 (diff) |
user routings refactor
Diffstat (limited to 'config')
-rw-r--r-- | config/routes.rb | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/config/routes.rb b/config/routes.rb index 2bfaa2c2af6..533c3b98e8e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -91,6 +91,9 @@ Rails.application.routes.draw do end end + get '/s/:username', to: redirect('/u/:username/snippets'), + constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } + # # Invites # @@ -340,26 +343,20 @@ Rails.application.routes.draw do end end - get 'u/:username/calendar' => 'users#calendar', as: :user_calendar, - constraints: { username: /.*/ } - - get 'u/:username/calendar_activities' => 'users#calendar_activities', as: :user_calendar_activities, - constraints: { username: /.*/ } - - get 'u/:username/groups' => 'users#groups', as: :user_groups, - constraints: { username: /.*/ } - - get 'u/:username/projects' => 'users#projects', as: :user_projects, - constraints: { username: /.*/ } - - get 'u/:username/contributed' => 'users#contributed', as: :user_contributed_projects, - constraints: { username: /.*/ } - - get 'u/:username/snippets' => 'users#snippets', as: :user_snippets, - constraints: { username: /.*/ } - - get '/u/:username' => 'users#show', as: :user, - constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } + resources(:users, + path: 'u', + param: :username, + constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, + only: :show) do + member do + get :calendar, as: :calendar + get :calendar_activities, as: :calendar_activities + get :groups, as: :groups + get :projects, as: :projects + get :contributed, as: :contributed_projects + get :snippets, as: :snippets + end + end # # Dashboard Area |