Class: Integral::CategoriesController

Inherits:
BlogController show all
Defined in:
app/controllers/integral/categories_controller.rb

Overview

Front end categories controller

Instance Method Summary collapse

Instance Method Details

#showObject

GET /:id Presents all posts with particular category



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/integral/categories_controller.rb', line 11

def show
  add_breadcrumb @resource.title, nil

  page_title = params[:page].present? ? "#{@resource.title} - Page #{params[:page]}" : @resource.title
  page_description = params[:page].present? ? "#{@resource.description} - Page #{params[:page]}" : @resource.description

  @meta_data = {
    page_title: page_title,
    page_description: page_description,
    image: @resource.image_url(size: :large)
  }

end

#url_for(options = {}) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'app/controllers/integral/categories_controller.rb', line 25

def url_for(options={})
  if options.is_a?(Hash) && options.include?(:category_path) && options[:category_path] == true
    "#{category_path(@resource)}?page=#{options[:page]}"
  elsif options.is_a?(Hash) && options.empty?
    category_path(@resource)
  else
    super(options)
  end
end