Module: ComfyPress::Routing

Defined in:
lib/comfypress/routing.rb

Class Method Summary collapse

Class Method Details

.admin(options = {}) ⇒ Object



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
# File 'lib/comfypress/routing.rb', line 3

def self.admin(options = {})
  options[:path] ||= 'cms-admin'
  
  Rails.application.routes.draw do
    namespace :cms_admin, :path => options[:path], :except => :show do
      get '/', :to => 'base#jump'
      resources :sites do
        resources :pages do
          get  :form_blocks,    :on => :member
          get  :toggle_branch,  :on => :member
          put :reorder,         :on => :collection
          resources :revisions, :only => [:index, :show, :revert] do
            put :revert, :on => :member
          end
          resources :tabs do
            put :reorder,       :on => :collection
          end
        end
        resources :files do
          put :reorder, :on => :collection
        end
        resources :layouts do
          put :reorder, :on => :collection
          resources :revisions, :only => [:index, :show, :revert] do
            put :revert, :on => :member
          end
        end
        resources :snippets do
          put :reorder, :on => :collection
          resources :revisions, :only => [:index, :show, :revert] do
            put :revert, :on => :member
          end
        end
        resources :categories
        resources :menus do
          resources :menu_items do
            put :reorder, :on => :collection
          end
        end
        resources :slides do
          put :reorder, :on => :collection
        end
        
        get 'dialog/:type' => 'dialogs#show', :as => 'dialog'
      end   #sites
    end
  end
end

.content(options = {}) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/comfypress/routing.rb', line 52

def self.content(options = {})
  
  Rails.application.routes.draw do
    namespace :cms_content, :path => options[:path] do
      get 'cms-css/:site_id/:identifier' => :render_css,  :as => 'css'
      get 'cms-js/:site_id/:identifier'  => :render_js,   :as => 'js'
      
      if options[:sitemap]
        get '(:cms_path)/sitemap' => :render_sitemap,
          :as           => 'sitemap',
          :constraints  => {:format => /xml/},
          :format       => :xml
      end
      
      get '/' => :render_html, :as => 'html', :path => "(*cms_path)"
    end
  end
end