retrospring/config/routes.rb

87 lines
4.5 KiB
Ruby
Raw Normal View History

2014-12-12 18:35:14 +01:00
require 'sidekiq/web'
2014-08-01 11:23:47 +02:00
Rails.application.routes.draw do
2014-12-05 07:02:23 +01:00
# Admin panel
2014-12-10 17:01:59 +01:00
mount RailsAdmin::Engine => '/justask_admin', as: 'rails_admin'
# Sidekiq
2014-12-12 18:35:14 +01:00
constraints ->(req) { req.env["warden"].authenticate?(scope: :user) &&
req.env['warden'].user.admin? } do
mount Sidekiq::Web, at: "/sidekiq"
end
# Moderation panel
constraints ->(req) { req.env['warden'].authenticate?(scope: :user) &&
(req.env['warden'].user.admin? or req.env['warden'].user.moderator?) } do
match '/moderation', to: 'moderation#index', via: :get, as: :moderation
end
2014-08-01 11:47:25 +02:00
root 'static#index'
2014-08-01 11:23:47 +02:00
2014-08-01 11:47:25 +02:00
match '/about', to: 'static#about', via: 'get'
2014-11-02 17:58:27 +01: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 13:21:41 +01:00
patch '/settings/account' => 'devise/registrations#update', as: :update_user_registration
2014-11-02 17:58:27 +01:00
put '/settings/account' => 'devise/registrations#update'
delete '/settings/account' => 'devise/registrations#destroy'
end
match '/settings/profile', to: 'user#edit', via: 'get', as: :edit_user_profile
2014-11-03 13:21:41 +01:00
match '/settings/profile', to: 'user#update', via: 'patch', as: :update_user_profile
2014-12-09 23:21:41 +01:00
2014-12-12 21:43:09 +01: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
namespace :ajax do
match '/ask', to: 'question#create', via: :post, as: :ask
2014-11-11 16:19:20 +01:00
match '/answer', to: 'inbox#destroy', via: :post, as: :answer
2014-12-09 23:21:41 +01:00
match '/generate_question', to: 'inbox#create', via: :post, as: :generate_question
match '/delete_inbox', to: 'inbox#remove', via: :post, as: :delete_inbox
match '/delete_all_inbox', to: 'inbox#remove_all', via: :post, as: :delete_all_inbox
2014-11-26 17:05:46 +01:00
match '/destroy_answer', to: 'answer#destroy', via: :post, as: :destroy_answer
2014-11-30 14:45:32 +01: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 20:31:22 +01:00
match '/create_smile', to: 'smile#create', via: :post, as: :create_smile
match '/destroy_smile', to: 'smile#destroy', via: :post, as: :destroy_smile
2014-12-07 14:29:35 +01:00
match '/create_comment', to: 'comment#create', via: :post, as: :create_comment
2014-12-28 19:55:50 +01:00
match '/report', to: 'report#create', via: :post, as: :report
end
2014-11-03 13:21:41 +01:00
2014-12-11 06:39:35 +01:00
match '/public', to: 'public#index', via: :get, as: :public_timeline
2014-12-14 15:17:52 +01:00
match '/notifications(/:type)', to: 'notifications#index', via: :get, as: :notifications, defaults: {type: 'all'}
2014-11-11 07:10:41 +01:00
match '/inbox', to: 'inbox#show', via: 'get'
2014-11-12 20:40:24 +01:00
match '/user/:username(/p/:page)', to: 'user#show', via: 'get', defaults: {page: 1}
match '/@:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile, defaults: {page: 1}
2014-12-05 07:02:23 +01:00
match '/@:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer
2014-12-07 20:51:44 +01:00
match '/@:username/q/:id', to: 'question#show', via: 'get', as: :show_user_question
2014-12-08 17:03:06 +01:00
match '/@:username/followers(/p/:page)', to: 'user#followers', via: 'get', as: :show_user_followers, defaults: {page: 1}
2014-12-08 19:51:34 +01:00
match '/@:username/friends(/p/:page)', to: 'user#friends', via: 'get', as: :show_user_friends, defaults: {page: 1}
2014-11-12 20:40:24 +01:00
match '/:username(/p/:page)', to: 'user#show', via: 'get', as: :show_user_profile_alt, defaults: {page: 1}
2014-12-05 07:02:23 +01:00
match '/:username/a/:id', to: 'answer#show', via: 'get', as: :show_user_answer_alt
2014-12-07 20:51:44 +01:00
match '/:username/q/:id', to: 'question#show', via: 'get', as: :show_user_question_alt
2014-12-08 17:03:06 +01:00
match '/:username/followers(/p/:page)', to: 'user#followers', via: 'get', as: :show_user_followers_alt, defaults: {page: 1}
2014-12-08 19:51:34 +01:00
match '/:username/friends(/p/:page)', to: 'user#friends', via: 'get', as: :show_user_friends_alt, defaults: {page: 1}
2014-12-19 22:34:24 +01:00
match '/:username/questions(/p/:page)', to: 'user#questions', via: 'get', as: :show_user_questions, defaults: {page: 1}
2014-08-01 11:23:47 +02:00
end