Module: BlogUrlHelpers

Extended by:
ActiveSupport::Concern
Included in:
Admin::PostsController, PostsController
Defined in:
app/controllers/concerns/blog_url_helpers.rb

Instance Method Summary collapse

Instance Method Details

#admin_post_path(post) ⇒ Object



44
45
46
# File 'app/controllers/concerns/blog_url_helpers.rb', line 44

def admin_post_path(post)
  url_for controller: '/admin/posts', action: 'show', id: post.id, blog_key: post.blog_key
end

#admin_post_preview_path(post) ⇒ Object



52
53
54
# File 'app/controllers/concerns/blog_url_helpers.rb', line 52

def admin_post_preview_path(post)
  url_for controller: '/admin/posts', action: :preview, post_id: post.id, blog_key: (post.blog_key || params[:blog_key])
end

#admin_posts_path(blog_key: nil) ⇒ Object

Admin



34
35
36
37
# File 'app/controllers/concerns/blog_url_helpers.rb', line 34

def admin_posts_path(blog_key: nil)
  blog_key ||= params[:blog_key]
  url_for controller: '/admin/posts', action: 'index', blog_key: blog_key
end

#edit_admin_post_path(post) ⇒ Object



48
49
50
# File 'app/controllers/concerns/blog_url_helpers.rb', line 48

def edit_admin_post_path(post)
  url_for controller: '/admin/posts', action: 'edit', id: post.id, blog_key: post.blog_key
end

#new_admin_post_path(blog_key: nil) ⇒ Object



39
40
41
42
# File 'app/controllers/concerns/blog_url_helpers.rb', line 39

def new_admin_post_path(blog_key: nil)
  blog_key ||= params[:blog_key]
  url_for controller: '/admin/posts', action: 'new', blog_key: blog_key
end

#post_archive_path(archive_date, opts = {}) ⇒ Object



22
23
24
# File 'app/controllers/concerns/blog_url_helpers.rb', line 22

def post_archive_path(archive_date, opts = {})
  url_for opts.merge(controller: '/posts', action: 'archive', archive_date: archive_date, blog_key: params[:blog_key])
end

#post_category_archive_path(category_url_name, archive_date, opts = {}) ⇒ Object



26
27
28
# File 'app/controllers/concerns/blog_url_helpers.rb', line 26

def (category_url_name, archive_date, opts = {})
  url_for opts.merge(controller: '/posts', action: 'category', category_url_name: category_url_name, archive_date: archive_date, blog_key: params[:blog_key])
end

#post_category_path(category_url_name, opts = {}) ⇒ Object



18
19
20
# File 'app/controllers/concerns/blog_url_helpers.rb', line 18

def (category_url_name, opts = {})
  url_for opts.merge(controller: '/posts', action: 'category', category_url_name: category_url_name, blog_key: params[:blog_key])
end

#post_path(url_name, opts = {}) ⇒ Object



14
15
16
# File 'app/controllers/concerns/blog_url_helpers.rb', line 14

def post_path(url_name, opts = {})
  url_for opts.merge(controller: '/posts', action: 'show', id: url_name, blog_key: params[:blog_key])
end

#posts_path(opts = {}) ⇒ Object



10
11
12
# File 'app/controllers/concerns/blog_url_helpers.rb', line 10

def posts_path(opts = {})
  url_for opts.merge(controller: '/posts', action: 'index', blog_key: params[:blog_key])
end