Sha256: 9f292f3223634221bf9f41c55fd8b96431ffed490417bf3fcfa0595db1939993

Contents?: true

Size: 750 Bytes

Versions: 11

Compression:

Stored size: 750 Bytes

Contents

# frozen_string_literal: true

class ActionDispatch::Routing::Mapper

  def comfy_route_blog(options = {})
    ComfyBlog.configuration.public_blog_path = options[:path] || "blog"
    path = ["(:cms_path)", ComfyBlog.configuration.public_blog_path].join("/")

    scope module: :comfy, as: :comfy do
      namespace :blog, path: path do
        with_options constraints: { year: %r{\d{4}}, month: %r{\d{1,2}} } do |o|
          o.get ":year",              to: "posts#index",  as: :posts_of_year
          o.get ":year/:month",       to: "posts#index",  as: :posts_of_month
          o.get ":year/:month/:slug", to: "posts#show",   as: :post
          o.get "/",                  to: "posts#index",  as: :posts
        end
      end
    end
  end

end

Version data entries

11 entries across 11 versions & 6 rubygems

Version Path
PixelForce_FyBlog-0.0.2 lib/comfy_blog/routes/blog.rb
PixelForce_FyBlog-0.0.1 lib/comfy_blog/routes/blog.rb
PixelForce_ComfyBlog-0.0.1 lib/comfy_blog/routes/blog.rb
EtsComfyBlog-0.0.4 lib/comfy_blog/routes/blog.rb
EtsComfyBlog-0.0.3 lib/comfy_blog/routes/blog.rb
EtsComfyBlog-0.0.2 lib/comfy_blog/routes/blog.rb
EtsComfyBlog-0.0.1 lib/comfy_blog/routes/blog.rb
ets_comfy_blog-0.0.1 lib/comfy_blog/routes/blog.rb
kcy_comfy_blog-2.0.7 lib/comfy_blog/routes/blog.rb
comfy_blog-2.0.7 lib/comfy_blog/routes/blog.rb
comfy_blog-2.0.6 lib/comfy_blog/routes/blog.rb