Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 93 additions & 96 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
Expand All @@ -97,40 +94,40 @@

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
get '/signup', action: :new, as: :new_user_registration
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [96/80]
Unnecessary spacing detected.
Put one space between the method name and the first argument.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

get '/settings/profile', to: 'users/profiles#edit', as: :edit_user_profile

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [87/80]
Unnecessary spacing detected.
Put one space between the method name and the first argument.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

get '/settings/notifications', to: "users/notifications#edit", as: :settings_notifications

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [97/80]
Unnecessary spacing detected.
Put one space between the method name and the first argument.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [95/80]
Unnecessary spacing detected.
Put one space between the method name and the first argument.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

get '/users/confirmation', to: 'users/confirmations#show', as: :user_confirmation

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [92/80]
Unnecessary spacing detected.
Put one space between the method name and the first argument.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

post '/users/confirmation', to: 'users/confirmations#create'

resources :users, only: [:show, :update] do
get :awarded_bounties, on: :member
Expand All @@ -140,20 +137,20 @@
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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [110/80]
Unnecessary spacing detected.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

post '/users/:id/dismiss_showcase_banner', to: 'users#dismiss_showcase_banner', as: :dismiss_showcase_banner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [112/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.


resources :notifications, only: [:index]
resources :choices, only: [:index, :create, :update, :destroy]

# 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]

Expand All @@ -168,45 +165,45 @@

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [99/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

post '/readraptor/daily', to: 'read_raptor#daily'
post '/readraptor/unread_comment', to: 'read_raptor#unread_coment', as: :readraptor_unread_comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [102/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

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'
post 'unfollow'
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')
Expand All @@ -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
Expand All @@ -242,7 +239,7 @@
end
resources :users

get '/' => redirect('/admin/withdrawals')
get '/', to: redirect('/admin/withdrawals')
end

scope :upload do
Expand All @@ -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
Expand Down Expand Up @@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [82/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

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
Expand All @@ -332,7 +329,7 @@

match 'flag', via: [:get, :post]

get '/transactions' => 'financials#transactions'
get '/transactions', to: 'financials#transactions'

get 'welcome'
get 'activity'
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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'
Expand Down Expand Up @@ -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
Expand Down