From 9421c384bc21c2f33b4f389804da491188395dfd Mon Sep 17 00:00:00 2001 From: lachlanjc Date: Mon, 1 Jun 2015 20:40:05 -0400 Subject: [PATCH] Cleanup for routes file --- config/routes.rb | 189 +++++++++++++++++++++++------------------------ 1 file changed, 93 insertions(+), 96 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index 85f9ff4ea..8f5373440 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,7 +5,7 @@ # api # ◕ᴥ◕ namespace :api, path: '/', constraints: { subdomain: 'api' }, defaults: { format: 'json' } do - get '/' => 'api#root' + get '/', to: 'api#root' resource :user, only: [:show] resource :users do @@ -27,12 +27,12 @@ authenticate :user, lambda { |u| u.staff? } do mount Sidekiq::Web => '/admin/sidekiq' - mount Split::Dashboard => '/admin/split' + mount Split::Dashboard => '/admin/split' mount PgHero::Engine => "/admin/postgres" end if Rails.env.development? - get "/impersonate/:id", :to => "users#impersonate", :as => :impersonate + get "/impersonate/:id", to: "users#impersonate", as: :impersonate end authenticated do @@ -42,53 +42,50 @@ # Global Chat Experiment resources :chat_rooms, only: [:index, :show], path: 'chat' - get '/still-field' => redirect('/discover') # bad product + get '/still-field', to: redirect('/discover') # bad product # Bugfix. Read more at https://assembly.com/meta/198 - get '/webhooks/pusher' => redirect('/discover') + get '/webhooks/pusher', to: redirect('/discover') # Internal get '/playground/:action', controller: 'playground' # Single sign-on - get '/sso' => 'single_sign_on#sso' + get '/sso', to: 'single_sign_on#sso' # Legacy get '/discover/blog', to: redirect('/discover/updates') get '/explore', to: redirect('/discover') get '/blog', to: redirect('http://blog.assembly.com') - # Pages - get '/home' => 'pages#home', as: :home - get '/about' => 'pages#about', as: :about - get '/terms' => 'pages#tos', as: :tos - get '/core-team' => 'pages#core_team', as: :core_team - get '/badges' => 'pages#badges', as: :badges - get '/pitchweek' => 'pages#pitch_week', as: :pitch_week - get '/sabbaticals' => 'pages#sabbaticals', as: :sabbaticals - get '/activity' => 'activity#index', as: :activity + # Pages (some use JS router) + get '/home', to: 'pages#home', as: :home + get '/about', to: 'pages#about', as: :about + get '/terms', to: 'pages#tos', as: :tos + get '/badges', to: 'pages#badges', as: :badges + get '/activity', to: 'activity#index', as: :activity - get '/getting-started' => 'pages#getting-started', as: :getting_started + get '/getting-started', to: 'pages#getting-started', as: :getting_started # Readraptor proxy. Remove this when javascript clients can talk directly to RR - get '/_rr/articles/:id' => 'readraptor#show', as: :readraptor_article + get '/_rr/articles/:id', to: 'readraptor#show', as: :readraptor_article - get '/create' => 'products#new', :as => :new_product - get '/start' => 'products#start', :as => :start_idea - get '/import' => 'products#import', :as => :import_idea + get '/create', to: 'products#new', as: :new_product + get '/start', to: 'products#start', as: :start_idea + get '/import', to: 'products#import', as: :import_idea - get '/styleguide' => 'pages#styleguide' + get '/styleguide', to: 'pages#styleguide' - get '/discover(.:format)' => 'apps#index', as: :discover + get '/discover(.:format)', to: 'apps#index', as: :discover resources :ideas do get '/start-conversation', on: :member, action: :start_conversation get '/admin', on: :member, action: :admin patch '/admin', on: :member, action: :admin_update patch :mark - patch '/up_score' => 'ideas#up_score' - patch '/down_score' => 'ideas#down_score' - get '/checklistitems' => 'ideas#checklistitems' + patch '/up_score', to: 'ideas#up_score' + patch '/down_score', to: 'ideas#down_score' + get '/checklistitems', to: 'ideas#checklistitems' end devise_for :users, @@ -97,10 +94,10 @@ as :user do # Sessions - get '/login' => 'users/sessions#new', :as => :new_user_session - post '/login' => 'users/sessions#create' - get '/user' => 'users/sessions#show', :as => :user_session - delete '/logout' => 'users/sessions#destroy', :as => :destroy_user_session + get '/login', to: 'users/sessions#new', as: :new_user_session + post '/login', to: 'users/sessions#create' + get '/user', to: 'users/sessions#show', as: :user_session + delete '/logout', to: 'users/sessions#destroy', as: :destroy_user_session # Registrations controller 'users/registrations' do @@ -108,29 +105,29 @@ post '/signup', action: :create, as: :user_registration end - get '/dashboard' => 'dashboard#index', as: :dashboard - get '/dashboard/:filter' => 'dashboard#index', as: :dashboard_filter + get '/dashboard', to: 'dashboard#index', as: :dashboard + get '/dashboard/:filter', to: 'dashboard#index', as: :dashboard_filter # settings - get '/settings' => 'users#edit', as: :edit_user - patch '/settings' => 'users/registrations#update' - get '/settings/email' => 'users/registrations#edit_email', :as => :edit_user_email - get '/settings/profile' => 'users/profiles#edit', :as => :edit_user_profile - get '/settings/notifications' => "users/notifications#edit", :as => :settings_notifications - patch '/settings/notifications' => "users/notifications#update" + get '/settings', to: 'users#edit', as: :edit_user + patch '/settings', to: 'users/registrations#update' + get '/settings/email', to: 'users/registrations#edit_email', as: :edit_user_email + get '/settings/profile', to: 'users/profiles#edit', as: :edit_user_profile + get '/settings/notifications', to: "users/notifications#edit", as: :settings_notifications + patch '/settings/notifications', to: "users/notifications#update" namespace :users, path: 'user' do resource :balance, only: [:show] { post :withdraw } resource :payment_option, only: [:show, :create, :update] resource :tax_info, only: [:show, :create, :update] do - get ':form_type' => 'tax_infos#show' + get ':form_type', to: 'tax_infos#show' end end # Confirmation - get '/users/confirmation/new' => 'users/confirmations#new', :as => :new_user_confirmation - get '/users/confirmation' => 'users/confirmations#show', :as => :user_confirmation - post '/users/confirmation' => 'users/confirmations#create' + get '/users/confirmation/new', to: 'users/confirmations#new', as: :new_user_confirmation + get '/users/confirmation', to: 'users/confirmations#show', as: :user_confirmation + post '/users/confirmation', to: 'users/confirmations#create' resources :users, only: [:show, :update] do get :awarded_bounties, on: :member @@ -140,12 +137,12 @@ patch :delete_account, on: :member end - get 'users/:id/stories' => 'users#stories' - get 'users/:id/stories/:product_id' => 'users#stories' - get '/users/:id/karma' => 'users#karma', :as => :user_karma - get '/users/:id/assets' => 'users#assets', :as => :user_assets - post '/users/:id/dismiss_welcome_banner' => 'users#dismiss_welcome_banner', :as => :dismiss_welcome_banner - post '/users/:id/dismiss_showcase_banner' => 'users#dismiss_showcase_banner', :as => :dismiss_showcase_banner + get 'users/:id/stories', to: 'users#stories' + get 'users/:id/stories/:product_id', to: 'users#stories' + get '/users/:id/karma', to: 'users#karma', as: :user_karma + get '/users/:id/assets', to: 'users#assets', as: :user_assets + post '/users/:id/dismiss_welcome_banner', to: 'users#dismiss_welcome_banner', as: :dismiss_welcome_banner + post '/users/:id/dismiss_showcase_banner', to: 'users#dismiss_showcase_banner', as: :dismiss_showcase_banner resources :notifications, only: [:index] resources :choices, only: [:index, :create, :update, :destroy] @@ -153,7 +150,7 @@ # saved searches scope '/user', controller: 'users' do get :unread - get 'tracking/:article_id' => 'users#tracking', :as => :readraptor + get 'tracking/:article_id', to: 'users#tracking', as: :readraptor resources :saved_searches, only: [:create, :destroy] @@ -168,30 +165,30 @@ resources :stories, only: [:show] - get '/leaderboards' => 'leaderboards#index' + get '/leaderboards', to: 'leaderboards#index' # Webhooks namespace :webhooks do - post '/assembly_assets/transaction' => 'assembly_assets#transaction' - post '/mailgun' => 'mailgun#create' - post '/mailgun/reply' => 'mailgun#reply' - post '/github' => 'github#create' - post '/landline' => 'landline#create' - post '/readraptor/immediate/:entity_id' => 'read_raptor#immediate', as: :readraptor_immediate - post '/readraptor/daily' => 'read_raptor#daily' - post '/readraptor/unread_comment' => 'read_raptor#unread_coment', as: :readraptor_unread_comment - post '/pusher' => 'pusher#auth' + post '/assembly_assets/transaction', to: 'assembly_assets#transaction' + post '/mailgun', to: 'mailgun#create' + post '/mailgun/reply', to: 'mailgun#reply' + post '/github', to: 'github#create' + post '/landline', to: 'landline#create' + post '/readraptor/immediate/:entity_id', to: 'read_raptor#immediate', as: :readraptor_immediate + post '/readraptor/daily', to: 'read_raptor#daily' + post '/readraptor/unread_comment', to: 'read_raptor#unread_coment', as: :readraptor_unread_comment + post '/pusher', to: 'pusher#auth' end # Facebook - get '/channel.html' => 'facebook#channel', :as => :facebook_channel + get '/channel.html', to: 'facebook#channel', as: :facebook_channel # Exceptions - get "/404", :to => "errors#not_found" - get "/500", :to => "errors#error" - get "/errors/crash", :to => "errors#test_exception" - get "/errors/maintenance", :to => "errors#maintenance" - get "/errors/heroku", :to => "errors#test_heroku" + get "/404", to: "errors#not_found" + get "/500", to: "errors#error" + get "/errors/crash", to: "errors#test_exception" + get "/errors/maintenance", to: "errors#maintenance" + get "/errors/heroku", to: "errors#test_heroku" resources :tags, only: [] do post 'follow' @@ -199,14 +196,14 @@ end # Help - get '/help/:group', :to => 'questions#index', :as => :help - get '/help' => redirect('/help/basics'), :as => :faq + get '/help/:group', to: 'questions#index', as: :help + get '/help', to: redirect('/help/basics'), as: :faq - get '/metrics' => 'metrics#overview' + get '/metrics', to: 'metrics#overview' # Guides - get '/guides/:group', :to => 'guides#index', :as => :guides - get '/guides', :to => 'guides#index' + get '/guides/:group', to: 'guides#index', as: :guides + get '/guides', to: 'guides#index' # redirect support-foo to helpful get '/support-foo', to: redirect('/helpful') @@ -219,7 +216,7 @@ resources :bitcoin, only: [:index] do get '/report', action: :report end - get '/bitcoin/report' => 'bitcoin#report' + get '/bitcoin/report', to: 'bitcoin#report' resources :bounties, only: [:index] do get :graph_data end @@ -242,7 +239,7 @@ end resources :users - get '/' => redirect('/admin/withdrawals') + get '/', to: redirect('/admin/withdrawals') end scope :upload do @@ -256,7 +253,7 @@ resources :users, only: [:index], module: :chat, path: 'online' end - post '/sb' => 'slack_bridge#receive' + post '/sb', to: 'slack_bridge#receive' resources :products, only: [] do get :info @@ -292,31 +289,31 @@ resources :textcompletes, only: [:index] end - root :to => 'pages#home' + root 'pages#home' - post '/products' => 'products#create', as: :products + post '/products', to: 'products#create', as: :products get '/products/:id', to: redirect(ProductRedirector.new), as: :full_product get '/products/:product_id/discussions/:id', to: redirect(ProductRedirector.new(:discussion)), as: :full_product_discussion get '/products/:product_id/tasks/:id', to: redirect(ProductRedirector.new(:task)), as: :full_product_task - get '/activities/:id' => 'activity#show' - get '/hotbounties' => 'hot_bounties#show' + get '/activities/:id', to: 'activity#show' + get '/hotbounties', to: 'hot_bounties#show' - get '/interests/:interest' => 'global_interests#toggle', as: :global_interests - get '/hello/:id' => 'hellos#show', as: :hello_user + get '/interests/:interest', to: 'global_interests#toggle', as: :global_interests + get '/hello/:id', to: 'hellos#show', as: :hello_user # custom oauth :( - get '/integrations/:provider/token' => 'integrations#token' - get '/integrations/:provider/callback' => 'integrations#callback' - get '/:product_id/integrations/:provider/authorize' => 'integrations#authorize', as: :product_integrations - put '/:product_id/integrations/:provider/update' => 'integrations#update' + get '/integrations/:provider/token', to: 'integrations#token' + get '/integrations/:provider/callback', to: 'integrations#callback' + get '/:product_id/integrations/:provider/authorize', to: 'integrations#authorize', as: :product_integrations + put '/:product_id/integrations/:provider/update', to: 'integrations#update' # legacy get '/meta/chat', to: redirect(path: '/chat/general') # FIXME: Fix news_feed_items_controller to allow missing product - get '/news_feed_items' => 'dashboard#news_feed_items' + get '/news_feed_items', to: 'dashboard#news_feed_items' resources :news_feed_items, only: [] do patch :update_task end @@ -332,7 +329,7 @@ match 'flag', via: [:get, :post] - get '/transactions' => 'financials#transactions' + get '/transactions', to: 'financials#transactions' get 'welcome' get 'activity' @@ -343,17 +340,17 @@ post 'unfollow' post 'make_idea' - post '/greenlight' => 'products#greenlight' + post '/greenlight', to: 'products#greenlight' - get '/checklistitems' => 'products#checklistitems' - get '/ownership' => 'products#ownership' - get '/coin' => 'products#coin' - get '/stories' => 'products#stories' + get '/checklistitems', to: 'products#checklistitems' + get '/ownership', to: 'products#ownership' + get '/coin', to: 'products#coin' + get '/stories', to: 'products#stories' - get '/trust' => 'products#trust' + get '/trust', to: 'products#trust' - get 'log' => 'stakes#show' - get 'search' => 'search#index' + get 'log', to: 'stakes#show' + get 'search', to: 'search#index' patch :launch get :old @@ -367,7 +364,7 @@ resources :product_logos, only: [:index, :show, :create, :update], as: :logos, path: 'logos' resources :news_feed_item_posts, only: [:show] resources :projects, only: [:index, :show, :new, :create, :edit, :update] do - put 'tasks/:id' => 'projects#add' + put 'tasks/:id', to: 'projects#add' resources :tasks, only: [:create, :destroy, :show, :update] patch :images @@ -378,7 +375,7 @@ resources :people, only: [:index, :create, :update, :destroy] resources :core_team_members, only: [:create] - get '/core' => 'core_team_members#index' + get '/core', to: 'core_team_members#index' resources :discussions, only: [:index, :show, :new, :edit, :create, :update] do patch :close, on: :member @@ -400,7 +397,7 @@ resources :awards, only: [:show] end resources :wips, only: [:index, :show, :new, :edit, :create, :update], controller: 'tasks', path: 'bounties' do - get 'search', :on => :collection + get 'search', :on, action: :collection get 'checkin' patch 'assign' @@ -446,7 +443,7 @@ resources :partners, only: [:index] resources :financials, only: [:index] - resource :financial, :module => :financial do + resource :financial, :module, action: :financial do resources :accounts, only: [:index, :show] resources :transactions, only: [:index, :show, :new, :create] end