2014-12-12 09:35:14 -08:00
|
|
|
require 'sidekiq/web'
|
2014-08-01 02:23:47 -07:00
|
|
|
Rails.application.routes.draw do
|
2014-12-04 22:02:23 -08:00
|
|
|
|
2014-12-26 04:46:47 -08:00
|
|
|
# Admin panel
|
2014-12-10 08:01:59 -08:00
|
|
|
mount RailsAdmin::Engine => '/justask_admin', as: 'rails_admin'
|
2014-12-26 04:46:47 -08:00
|
|
|
|
|
|
|
# Sidekiq
|
2014-12-12 09:35:14 -08:00
|
|
|
constraints ->(req) { req.env["warden"].authenticate?(scope: :user) &&
|
|
|
|
req.env['warden'].user.admin? } do
|
|
|
|
mount Sidekiq::Web, at: "/sidekiq"
|
|
|
|
end
|
|
|
|
|
2014-12-26 04:46:47 -08:00
|
|
|
# Moderation panel
|
|
|
|
constraints ->(req) { req.env['warden'].authenticate?(scope: :user) &&
|
2015-02-03 08:48:30 -08:00
|
|
|
(req.env['warden'].user.mod?) } do
|
2015-07-23 10:38:42 -07:00
|
|
|
match '/moderation/priority(/:user_id)', to: 'moderation#priority', via: :get, as: :moderation_priority
|
|
|
|
match '/moderation/ip/:user_id', to: 'moderation#ip', via: :get, as: :moderation_ip
|
2014-12-28 16:25:48 -08:00
|
|
|
match '/moderation(/:type)', to: 'moderation#index', via: :get, as: :moderation, defaults: {type: 'all'}
|
2014-12-28 14:26:16 -08:00
|
|
|
namespace :ajax do
|
2014-12-28 15:21:06 -08:00
|
|
|
match '/mod/destroy_report', to: 'moderation#destroy_report', via: :post, as: :mod_destroy_report
|
2014-12-28 15:50:14 -08:00
|
|
|
match '/mod/create_comment', to: 'moderation#create_comment', via: :post, as: :mod_create_comment
|
|
|
|
match '/mod/destroy_comment', to: 'moderation#destroy_comment', via: :post, as: :mod_destroy_comment
|
|
|
|
match '/mod/create_vote', to: 'moderation#vote', via: :post, as: :mod_create_vote
|
2014-12-28 14:26:16 -08:00
|
|
|
match '/mod/destroy_vote', to: 'moderation#destroy_vote', via: :post, as: :mod_destroy_vote
|
2015-02-03 08:48:30 -08:00
|
|
|
match '/mod/privilege', to: 'moderation#privilege', via: :post, as: :mod_privilege
|
2015-04-22 17:56:29 -07:00
|
|
|
match '/mod/ban', to: 'moderation#ban', via: :post, as: :mod_ban
|
2014-12-28 14:26:16 -08:00
|
|
|
end
|
2014-12-26 04:46:47 -08:00
|
|
|
end
|
|
|
|
|
2014-08-01 02:47:25 -07:00
|
|
|
root 'static#index'
|
2014-08-01 02:23:47 -07:00
|
|
|
|
2014-08-01 02:47:25 -07:00
|
|
|
match '/about', to: 'static#about', via: 'get'
|
2015-01-07 12:30:52 -08:00
|
|
|
match '/help/faq', to: 'static#faq', via: 'get', as: :help_faq
|
2015-01-16 13:36:39 -08:00
|
|
|
match '/privacy', to: 'static#privacy_policy', via: 'get', as: :privacy_policy
|
2015-01-16 14:16:28 -08:00
|
|
|
match '/terms', to: 'static#terms', via: 'get', as: :terms
|
2014-11-02 08:58:27 -08:00
|
|
|
|
|
|
|
# Devise routes
|
|
|
|
devise_for :users, path: 'user', skip: [:sessions, :registrations]
|
|
|
|
as :user do
|
|
|
|
# :sessions
|
|
|
|
get 'sign_in' => 'devise/sessions#new', as: :new_user_session
|
|
|
|
post 'sign_in' => 'devise/sessions#create', as: :user_session
|
|
|
|
delete 'sign_out' => 'devise/sessions#destroy', as: :destroy_user_session
|
|
|
|
# :registrations
|
|
|
|
get 'settings/delete_account' => 'devise/registrations#cancel', as: :cancel_user_registration
|
|
|
|
post '/user/create' => 'devise/registrations#create', as: :user_registration
|
|
|
|
get '/sign_up' => 'devise/registrations#new', as: :new_user_registration
|
|
|
|
get '/settings/account' => 'devise/registrations#edit', as: :edit_user_registration
|
2014-11-03 04:21:41 -08:00
|
|
|
patch '/settings/account' => 'devise/registrations#update', as: :update_user_registration
|
2014-11-02 08:58:27 -08:00
|
|
|
put '/settings/account' => 'devise/registrations#update'
|
2015-07-14 16:44:35 -07:00
|
|
|
delete '/settings/account' => 'user/registrations#destroy'
|
2014-11-02 08:58:27 -08:00
|
|
|
end
|
|
|
|
|
|
|
|
match '/settings/profile', to: 'user#edit', via: 'get', as: :edit_user_profile
|
2014-11-03 04:21:41 -08:00
|
|
|
match '/settings/profile', to: 'user#update', via: 'patch', as: :update_user_profile
|
2014-12-09 14:21:41 -08:00
|
|
|
|
2015-08-25 01:26:36 -07:00
|
|
|
match '/settings/theme', to: 'user#edit_theme', via: 'get', as: :edit_user_theme
|
|
|
|
match '/settings/theme', to: 'user#update_theme', via: 'patch', as: :update_user_theme
|
|
|
|
|
2014-12-12 12:43:09 -08:00
|
|
|
# resources :services, only: [:index, :destroy]
|
|
|
|
match '/settings/services', to: 'services#index', via: 'get', as: :services
|
|
|
|
match '/settings/services/:id', to: 'services#destroy', via: 'delete', as: :service
|
|
|
|
controller :services do
|
|
|
|
scope "/auth", as: "auth" do
|
|
|
|
get ':provider/callback' => :create
|
|
|
|
get :failure
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-01-03 12:58:56 -08:00
|
|
|
match '/settings/privacy', to: 'user#edit_privacy', via: :get, as: :edit_user_privacy
|
|
|
|
match '/settings/privacy', to: 'user#update_privacy', via: :patch, as: :update_user_privacy
|
2015-01-02 12:34:56 -08:00
|
|
|
|
2015-06-20 11:38:07 -07:00
|
|
|
match '/settings/data', to: 'user#data', via: :get, as: :user_data
|
|
|
|
|
2014-11-10 04:04:10 -08:00
|
|
|
namespace :ajax do
|
2014-11-10 12:56:30 -08:00
|
|
|
match '/ask', to: 'question#create', via: :post, as: :ask
|
2015-04-25 18:36:25 -07:00
|
|
|
match '/destroy_question', to: 'question#destroy', via: :post, as: :destroy_question
|
2014-12-09 14:21:41 -08:00
|
|
|
match '/generate_question', to: 'inbox#create', via: :post, as: :generate_question
|
2014-11-30 09:05:51 -08:00
|
|
|
match '/delete_inbox', to: 'inbox#remove', via: :post, as: :delete_inbox
|
2014-12-21 04:41:57 -08:00
|
|
|
match '/delete_all_inbox', to: 'inbox#remove_all', via: :post, as: :delete_all_inbox
|
2015-07-17 11:29:19 -07:00
|
|
|
match '/delete_all_inbox/:author', to: 'inbox#remove_all_author', via: :post, as: :delete_all_author
|
2015-01-03 09:40:39 -08:00
|
|
|
match '/answer', to: 'answer#create', via: :post, as: :answer
|
2014-11-26 08:05:46 -08:00
|
|
|
match '/destroy_answer', to: 'answer#destroy', via: :post, as: :destroy_answer
|
2014-11-30 05:45:32 -08:00
|
|
|
match '/create_friend', to: 'friend#create', via: :post, as: :create_friend
|
|
|
|
match '/destroy_friend', to: 'friend#destroy', via: :post, as: :destroy_friend
|
2014-11-30 11:31:22 -08:00
|
|
|
match '/create_smile', to: 'smile#create', via: :post, as: :create_smile
|
|
|
|
match '/destroy_smile', to: 'smile#destroy', via: :post, as: :destroy_smile
|
2015-05-03 18:39:41 -07:00
|
|
|
match '/create_comment_smile', to: 'smile#create_comment', via: :post, as: :create_comment_smile
|
|
|
|
match '/destroy_comment_smile', to: 'smile#destroy_comment', via: :post, as: :destroy_comment_smile
|
2014-12-07 05:29:35 -08:00
|
|
|
match '/create_comment', to: 'comment#create', via: :post, as: :create_comment
|
2014-12-28 12:14:01 -08:00
|
|
|
match '/destroy_comment', to: 'comment#destroy', via: :post, as: :destroy_comment
|
2014-12-28 10:55:50 -08:00
|
|
|
match '/report', to: 'report#create', via: :post, as: :report
|
2015-01-17 09:24:36 -08:00
|
|
|
match '/create_group', to: 'group#create', via: :post, as: :create_group
|
2015-01-17 09:57:23 -08:00
|
|
|
match '/destroy_group', to: 'group#destroy', via: :post, as: :destroy_group
|
2015-01-17 08:50:25 -08:00
|
|
|
match '/group_membership', to: 'group#membership', via: :post, as: :group_membership
|
2015-04-18 15:17:13 -07:00
|
|
|
match '/preview', to: "question#preview", via: :post, as: :preview
|
2015-04-20 18:12:11 -07:00
|
|
|
match '/subscribe', to: 'subscription#subscribe', via: :post, as: :subscribe_answer
|
|
|
|
match '/unsubscribe', to: 'subscription#unsubscribe', via: :post, as: :unsubscribe_answer
|
2014-11-10 04:04:10 -08:00
|
|
|
end
|
2014-11-03 04:21:41 -08:00
|
|
|
|
2015-05-13 11:56:51 -07:00
|
|
|
match '/discover', to: 'discover#index', via: :get, as: :discover
|
2014-12-10 21:39:35 -08:00
|
|
|
match '/public', to: 'public#index', via: :get, as: :public_timeline
|
2015-01-13 04:23:12 -08:00
|
|
|
match '/group/:group_name', to: 'group#index', via: :get, as: :group_timeline
|
2014-12-10 21:39:35 -08:00
|
|
|
|
2014-12-14 06:17:52 -08:00
|
|
|
match '/notifications(/:type)', to: 'notifications#index', via: :get, as: :notifications, defaults: {type: 'all'}
|
|
|
|
|
2014-11-10 22:10:41 -08:00
|
|
|
match '/inbox', to: 'inbox#show', via: 'get'
|
2015-07-17 12:02:53 -07:00
|
|
|
match '/inbox/:author', to: 'inbox#show', via: 'get'
|
2015-04-18 15:17:13 -07:00
|
|
|
|
2014-11-12 11:40:24 -08:00
|
|
|
match '/user/:username(/p/:page)', to: 'user#show', via: 'get', defaults: {page: 1}
|
2015-01-17 07:29:11 -08:00
|
|
|
match '/@:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile_alt, defaults: {page: 1}
|
|
|
|
match '/@:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer_alt
|
|
|
|
match '/@:username/q/:id', to: 'question#show', via: 'get', as: :show_user_question_alt
|
|
|
|
match '/@:username/followers(/p/:page)', to: 'user#followers', via: 'get', as: :show_user_followers_alt, defaults: {page: 1}
|
|
|
|
match '/@:username/friends(/p/:page)', to: 'user#friends', via: 'get', as: :show_user_friends_alt, defaults: {page: 1}
|
|
|
|
match '/:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile, defaults: {page: 1}
|
|
|
|
match '/:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer
|
|
|
|
match '/:username/q/:id', to: 'question#show', via: 'get', as: :show_user_question
|
|
|
|
match '/:username/followers(/p/:page)', to: 'user#followers', via: 'get', as: :show_user_followers, defaults: {page: 1}
|
|
|
|
match '/:username/friends(/p/:page)', to: 'user#friends', via: 'get', as: :show_user_friends, defaults: {page: 1}
|
|
|
|
match '/:username/groups(/p/:page)', to: 'user#groups', via: 'get', as: :show_user_groups, defaults: {page: 1}
|
2014-12-19 13:34:24 -08:00
|
|
|
match '/:username/questions(/p/:page)', to: 'user#questions', via: 'get', as: :show_user_questions, defaults: {page: 1}
|
2014-08-01 02:23:47 -07:00
|
|
|
end
|