forked from SpinaCMS/Spina
-
Notifications
You must be signed in to change notification settings - Fork 0
/
routes.rb
82 lines (65 loc) · 2.73 KB
/
routes.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Spina::Engine.routes.draw do
# Backend
namespace :admin, path: Spina.config.backend_path do
root to: "pages#index"
resource :account do
member do
get :style
get :analytics
get :social
end
end
get "/settings/:plugin", to: "settings#edit", as: :edit_settings
patch "/settings/:plugin", to: "settings#update", as: :settings
resources :users
# Sessions
resources :sessions
get "login" => "sessions#new"
get "logout" => "sessions#destroy"
# Passwords
resources :password_resets
# Media library
get 'media_library' => 'photos#media_library', as: "media_library"
resources :pages do
post :sort, on: :collection
end
resources :navigations do
post :sort, on: :member
end
resources :attachments do
collection do
get 'select/:page_part_id' => 'attachments#select', as: :select
post 'insert/:page_part_id' => 'attachments#insert', as: :insert
get 'select_collection/:page_part_id' => 'attachments#select_collection', as: :select_collection
post 'insert_collection/:page_part_id' => 'attachments#insert_collection', as: :insert_collection
end
end
resources :media_folders
resources :photos do
collection do
get 'trix_select/:object_id' => 'photos#trix_select', as: :trix_select
post 'trix_insert/:object_id' => 'photos#trix_insert', as: :trix_insert
get 'photo_select/:page_part_id' => 'photos#photo_select', as: :photo_select
get 'photo_collection_select/:page_part_id' => 'photos#photo_collection_select', as: :photo_collection_select
post 'insert_photo/:page_part_id' => 'photos#insert_photo', as: :insert_photo
post 'insert_photo_collection/:page_part_id' => 'photos#insert_photo_collection', as: :insert_photo_collection
get 'folder/:id' => 'photos#media_folder', as: :media_folder
put 'folder/:id' => 'photos#add_to_media_folder', as: :add_to_media_folder
end
end
end
# Sitemap
resource :sitemap
# Robots.txt
get '/robots', to: 'pages#robots', constraints: { format: 'txt' }
unless Spina.config.disable_frontend_routes
# Frontend
root to: "pages#homepage"
# Pages
get '/:locale/*id' => 'pages#show', constraints: {locale: /#{Spina.config.locales.join('|')}/ }
get '/:locale/' => 'pages#homepage', constraints: {locale: /#{Spina.config.locales.join('|')}/ }
get '/*id' => 'pages#show', as: "page", controller: 'pages', constraints: lambda { |request|
!(Rails.env.development? && request.env['PATH_INFO'].starts_with?('/rails/') || request.env['PATH_INFO'].starts_with?("/#{Spina.config.backend_path}") || request.env['PATH_INFO'].starts_with?('/attachments/'))
}
end
end