Sha256: dd01d0fce9ec1a60fce0ec1d7d5e6fd6decdfc7e94ef6fc0c5edf07c11887569

Contents?: true

Size: 1.95 KB

Versions: 4

Compression:

Stored size: 1.95 KB

Contents

module ComfortableMexicanSofa::Routing
  
  def self.admin(options = {})
    options[:path] ||= 'admin'
    
    Rails.application.routes.draw 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
              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
  end
  
  def self.content(options = {})
    
    Rails.application.routes.draw do
      namespace :cms, :path => options[:path] do
        get 'cms-css/:site_id/:identifier' => 'content#render_css', :as => 'render_css'
        get 'cms-js/:site_id/:identifier'  => 'content#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 '/' => 'content#render_html', :as => 'render_html', :path => "(*cms_path)"
      end
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
comfortable_mexican_sofa-1.10.3 lib/comfortable_mexican_sofa/routing.rb
comfortable_mexican_sofa-1.10.2 lib/comfortable_mexican_sofa/routing.rb
comfortable_mexican_sofa-1.10.1 lib/comfortable_mexican_sofa/routing.rb
comfortable_mexican_sofa-1.10.0 lib/comfortable_mexican_sofa/routing.rb