Sha256: 3e323b5bf5b1b28186540c2d01cdb1c2f7f08a1341b7e38481bc5dc77b2730e1

Contents?: true

Size: 1.79 KB

Versions: 3

Compression:

Stored size: 1.79 KB

Contents

module ComfortableMexicanSofa::Routing
  
  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
              patch :revert, :on => :member
            end
          end
          resources :files do
            post :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
  
  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
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.9.3 lib/comfortable_mexican_sofa/routing.rb
comfortable_mexican_sofa-1.9.2 lib/comfortable_mexican_sofa/routing.rb
comfortable_mexican_sofa-1.9.1 lib/comfortable_mexican_sofa/routing.rb