Class: ActionDispatch::Routing::Mapper
- Inherits:
-
Object
- Object
- ActionDispatch::Routing::Mapper
- Defined in:
- lib/comfy_blog/routes/blog_admin.rb,
lib/comfy_blog/routes/blog.rb
Instance Method Summary collapse
Instance Method Details
#comfy_route_blog(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/comfy_blog/routes/blog.rb', line 5 def comfy_route_blog( = {}) ComfyBlog.configuration.public_blog_path = [:path] || "blog" path = ["(:cms_path)", ComfyBlog.configuration.public_blog_path].join("/") scope module: :comfy, as: :comfy do namespace :blog, path: path do 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 |
#comfy_route_blog_admin(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/comfy_blog/routes/blog_admin.rb', line 5 def comfy_route_blog_admin( = {}) [:path] ||= "admin" path = [[:path], "sites", ":site_id"].join("/") scope module: :comfy, as: :comfy do scope module: :admin do namespace :blog, as: :admin, path: path, except: [:show] do resources :posts, as: :blog_posts, path: "blog-posts" do get :form_fragments, on: :member resources :revisions, only: %i[index show], controller: "revisions/post" do patch :revert, on: :member end end end end end end |