Class: ActionDispatch::Routing::Mapper

Inherits:
Object
  • Object
show all
Defined in:
lib/comfy_archive/routes/archive_admin.rb,
lib/comfy_archive/routes/archive.rb

Instance Method Summary collapse

Instance Method Details

#comfy_route_archive(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/comfy_archive/routes/archive.rb', line 5

def comfy_route_archive(options = {})
  scope module: :comfy, as: :comfy do
    namespace :archive, path: options[:path] do
      with_options constraints: { year: %r{\d{4}}, month: %r{\d{1,2}} } do |o|
        o.get "*cms_path/:year",          to: "index#index", as: :pages_of_year
        o.get "*cms_path/:year/:month",   to: "index#index", as: :pages_of_month
      end
      get "*cms_path/category/:category", to: "index#index", as: :pages_of_category
      get "(*cms_path)",                  to: "index#index", as: :render_page, action: "/:format"
    end
  end
end

#comfy_route_archive_admin(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/comfy_archive/routes/archive_admin.rb', line 5

def comfy_route_archive_admin(options = {})
  options[:path] ||= "admin"
  path = [options[:path], "sites", ":site_id"].join("/")

  scope module: :comfy, as: :comfy do
    scope module: :admin do
      namespace :archive, as: :admin, path: path, except: [:show] do
        resources :indices, as: :archive_indices, path: "archive-indices" do
          get :form_fragments, on: :member
        end
      end
    end
  end
end