Class: Integral::Router
- Inherits:
-
Object
- Object
- Integral::Router
- Defined in:
- lib/integral/router.rb
Overview
Handles Integral routing
Class Method Summary collapse
-
.draw_backend ⇒ Object
Draws backend routes.
-
.draw_frontend ⇒ Object
Draws frontend routes including dynamic pages and blog routes.
-
.draw_root ⇒ Object
Draws root route.
-
.load ⇒ Object
Loads Integral routes.
Class Method Details
.draw_backend ⇒ Object
Draws backend routes
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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/integral/router.rb', line 45 def self.draw_backend Integral::Engine.routes.draw do # Backend [User Only] scope Integral.backend_namespace do # User Authentication devise_for :users, class_name: 'Integral::User', module: :devise # WYSIWYG Editor mount Ckeditor::Engine => '/ckeditor' end namespace :backend, path: Integral.backend_namespace do get '/', to: 'static_pages#dashboard', as: 'dashboard' # User account Profile route get 'account', to: 'users#account' # User Management resources :users do get 'list', on: :collection member do get 'activities', controller: 'users' get 'activities/:activity_id', to: 'users#activity', as: :activity end end # Image Management resources :images, as: :img # Page Management resources :pages do get 'list', on: :collection member do post 'duplicate' get 'activities', controller: 'pages' get 'activities/:activity_id', to: 'pages#activity', as: :activity end end # Activity Management resources :activities, only: i[index show] do collection do post 'widget' post 'grid' end end # Post Management if Integral.blog_enabled? resources :posts do get 'list', on: :collection member do post 'duplicate' get 'activities', controller: 'posts' get 'activities/:activity_id', to: 'posts#activity', as: :activity end # resources :comments, only: [:create, :destroy] end resources :categories, only: i[create edit update destroy] do member do get 'activities', controller: 'categories' get 'activities/:activity_id', to: 'categories#activity', as: :activity end end end # List Management resources :lists, except: [:show] do member do post 'duplicate' end end # Settings Management resources :settings, only: i[index create] end end end |
.draw_frontend ⇒ Object
Draws frontend routes including dynamic pages and blog routes
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/integral/router.rb', line 23 def self.draw_frontend Integral::Engine.routes.draw do # Dynamic pages (URLs are rewritten in Integral::Middleware::PageRouter) resources :pages, only: i[show] # Visitor enquiries & newsletter signups post 'contact', to: 'contact#contact' post 'newsletter_signup', to: 'contact#newsletter_signup' # Frontend Blog routes if Integral.blog_enabled? scope Integral.blog_namespace do resources :tags, only: i[index show] resources :categories, only: i[show] end # Post Routing must go after tags otherwise it will override resources Integral.blog_namespace, only: i[show index], as: :posts, controller: 'posts' end end end |
.draw_root ⇒ Object
Draws root route
12 13 14 15 16 17 18 19 20 |
# File 'lib/integral/router.rb', line 12 def self.draw_root Integral::Engine.routes.draw do if Integral.dynamic_homepage_enabled? root 'pages#show' else root Integral.root_path end end end |
.load ⇒ Object
Loads Integral routes
5 6 7 8 9 |
# File 'lib/integral/router.rb', line 5 def self.load draw_root draw_frontend draw_backend end |