-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f0a8a2
commit 022277c
Showing
6 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
class ActionDispatch::Routing::Mapper | ||
def occams_route_cms(options = {}) | ||
Occams.configuration.public_cms_path = options[:path] | ||
|
||
scope module: :occams, as: :occams do | ||
namespace :cms, path: options[:path] do | ||
get 'cms-css/:site_id/:identifier(/:cache_buster)' => 'assets#render_css', as: 'render_css' | ||
get 'cms-js/:site_id/:identifier(/:cache_buster)' => 'assets#render_js', as: 'render_js' | ||
|
||
get '(*cms_path)' => 'content#show', as: 'render_page', action: '/:format' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# frozen_string_literal: true | ||
|
||
class ActionDispatch::Routing::Mapper | ||
def occams_route_cms_admin(path: 'admin') | ||
scope module: :occams, as: :occams do | ||
scope module: :admin do | ||
namespace :cms, as: :admin_cms, path: path, except: :show do | ||
get '/', to: 'base#jump' | ||
|
||
concern :with_revisions do |options| | ||
resources :revisions, options.merge(only: %i[index show]) do | ||
patch :revert, on: :member | ||
end | ||
end | ||
|
||
concern :with_reorder do | ||
put :reorder, on: :collection | ||
end | ||
|
||
concern :with_form_fragments do | ||
get :form_fragments, on: :member | ||
end | ||
|
||
resources :sites do | ||
resources :pages do | ||
concerns :with_reorder | ||
concerns :with_form_fragments | ||
concerns :with_revisions, controller: 'revisions/page' | ||
|
||
get :toggle_branch, on: :member | ||
|
||
resources :translations, except: [:index] do | ||
concerns :with_form_fragments | ||
concerns :with_revisions, controller: 'revisions/translation' | ||
end | ||
end | ||
|
||
resources :files, concerns: [:with_reorder] | ||
|
||
resources :layouts do | ||
concerns :with_reorder | ||
concerns :with_revisions, controller: 'revisions/layout' | ||
end | ||
|
||
resources :snippets do | ||
concerns :with_reorder | ||
concerns :with_revisions, controller: 'revisions/snippet' | ||
end | ||
|
||
resources :categories | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../test_helper' | ||
|
||
class AdminRoutesTest < ActionDispatch::IntegrationTest | ||
def setup | ||
@site = occams_cms_sites(:default) | ||
end | ||
|
||
def teardown | ||
Rails.application.reload_routes! | ||
end | ||
|
||
def test_cms_admin_routes | ||
assert_routing '/admin', controller: 'occams/admin/cms/base', action: 'jump' | ||
assert_routing '/auth/identity/callback', | ||
:controller => 'occams/cms/content', | ||
:action => 'show', | ||
cms_path: 'auth/identity/callback' | ||
|
||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters