Module: Hancock::Catalog::Controllers::Categories

Extended by:
ActiveSupport::Concern
Included in:
Hancock::Catalog::CategoriesController
Defined in:
lib/hancock/catalog/controllers/categories.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



12
13
14
15
16
# File 'lib/hancock/catalog/controllers/categories.rb', line 12

def index
  @categories = category_class.enabled.sorted.page(params[:page])
  @root_catalog = category_class.enabled.roots.sorted.all
  # index_crumbs
end

#page_titleObject



38
39
40
41
42
43
44
# File 'lib/hancock/catalog/controllers/categories.rb', line 38

def page_title
  if @category
    @category.page_title
  else
    super
  end
end

#showObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/hancock/catalog/controllers/categories.rb', line 18

def show
  @category = category_class.enabled.find(params[:id])
  if !@category.text_slug.blank? and @category.text_slug != params[:id]
    redirect_to hancock_catalog_category_path(@category), status_code: 301
    return
  end
  @seo_parent_page = find_seo_page(url_for(action: :index))

  @children = @category.children.enabled.sorted.all
  @items = @category.items.enabled.sorted.all.page(params[:page])

  if Hancock::Catalog.config.breadcrumbs_on_rails_support
    add_breadcrumb @category.name, hancock_catalog_category_path(@category), if: :insert_breadcrumbs
  end


  # index_crumbs
  # category_crumbs
end