Sha256: 38cfb37520063696ea71f8bf389f76532b92c9f4fa137aac87641afdc2511658

Contents?: true

Size: 1.31 KB

Versions: 2

Compression:

Stored size: 1.31 KB

Contents

module C80Yax
  module Frontend
    module CatalogIndexHelper

      def c80_yax_render_catalog_index(thumb_size = 'thumb_md', page=1, per_page = 16)
        itms = C80Yax::Item.includes(item_props: {prop_name: [:uom, :related]})
                   .includes(:iphotos)
                   .includes(:strsubcat)
                   .paginate(page: page, per_page: per_page)
        items = ItemDecorator.decorate_collection(itms)
        render partial: 'c80_yax/items/index',
               locals: {
                   items: items,
                   without_paginator: false,
                   will_paginate_items: itms,
                   thumb_size: thumb_size
               }
      end

      def c80_yax_render_related(item, thumb_size = 'thumb_md', count = 4)
        itms = C80Yax::Item.includes(item_props: {prop_name: [:uom, :related]})
                   .includes(:iphotos)
                   .includes(:strsubcat)
                   .where(c80_yax_items: { strsubcat_id: item.strsubcat.id })
                   .limit(count)
        items = ItemDecorator.decorate_collection(itms)
        render partial: 'c80_yax/items/index',
               locals: {
                   items: items,
                   without_paginator: true,
                   thumb_size: thumb_size
               }
      end

      private

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
c80_yax-0.1.0.9 app/helpers/c80_yax/frontend/catalog_index_helper.rb
c80_yax-0.1.0.8 app/helpers/c80_yax/frontend/catalog_index_helper.rb