Module: Hancock::Catalog::Controllers::Items

Extended by:
ActiveSupport::Concern
Included in:
ItemsController
Defined in:
lib/hancock/catalog/controllers/items.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



12
13
14
15
16
17
18
19
# File 'lib/hancock/catalog/controllers/items.rb', line 12

def index
  @items = item_class.enabled.sorted.page(params[:page])
  insert_category_breadcrumbs if insert_breadcrumbs

  unless Hancock::Catalog.config.items_per_page.nil?
    @items = @items.page(params[:page]).per(Hancock::Catalog.config.items_per_page)
  end
end

#showObject



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hancock/catalog/controllers/items.rb', line 21

def show
  @item = item_class.enabled.find(params[:id])

  if @item and @item.text_slug != params[:id]
    redirect_to hancock_catalog_item_path(@item), status_code: 301
    return true
  end

  if Hancock::Catalog.config.breadcrumbs_on_rails_support
    insert_category_breadcrumbs if insert_breadcrumbs
    add_breadcrumb @item.name, hancock_catalog_item_path(@item), if: :insert_breadcrumbs
  end
end