Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/comfortable_mexican_sofa/routes/cms_admin.rb,
lib/comfortable_mexican_sofa/routes/cms.rb,
lib/comfortable_mexican_sofa/routing.rb

Instance Method Summary collapse

Instance Method Details

#comfy_route(identifier, options = {}) ⇒ Object



5
6
7
# File 'lib/comfortable_mexican_sofa/routing.rb', line 5

def comfy_route(identifier, options = {})
  send("comfy_route_#{identifier}", options)
end

#comfy_route_cms(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/comfortable_mexican_sofa/routes/cms.rb', line 3

def comfy_route_cms(options = {})
  scope :module => :comfy, :as => :comfy 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'

      if options[:sitemap]
        get '(:cms_path)/sitemap' => 'content#render_sitemap',
          :as           => 'render_sitemap',
          :constraints  => {:format => /xml/},
          :format       => :xml
      end

      get '/:format' => 'content#show', :as => 'render_page', :path => "(*cms_path)"
    end
  end
end

#comfy_route_cms_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
# File 'lib/comfortable_mexican_sofa/routes/cms_admin.rb', line 3

def comfy_route_cms_admin(options = {})
  options[:path] ||= 'admin'

  scope :module => :comfy, :as => :comfy do
    scope :module => :admin do
      namespace :cms, :as => :admin_cms, :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
              patch :revert, :on => :member
            end
          end
          resources :files do
            put :reorder, :on => :collection
          end
          resources :layouts do
            put :reorder, :on => :collection
            resources :revisions, :only => [:index, :show, :revert] do
              patch :revert, :on => :member
            end
          end
          resources :snippets do
            put :reorder, :on => :collection
            resources :revisions, :only => [:index, :show, :revert] do
              patch :revert, :on => :member
            end
          end
          resources :categories
        end
      end
    end
  end
end