Sha256: d607aaec0e8b12b4e0bd50df0d37e8cbb6b5329fe5acff90fffd90ad6aaf25fe

Contents?: true

Size: 1.87 KB

Versions: 3

Compression:

Stored size: 1.87 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

      def c80_yax_render_similar(item, thumb_size = 'thumb_md', count = 4)
        itms = item.similar_items
                   .includes(item_props: {prop_name: [:uom, :related]})
                   .includes(:iphotos)
                   .includes(:strsubcat)
                   .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

3 entries across 3 versions & 1 rubygems

Version Path
c80_yax-0.1.0.12 app/helpers/c80_yax/frontend/catalog_index_helper.rb
c80_yax-0.1.0.11 app/helpers/c80_yax/frontend/catalog_index_helper.rb
c80_yax-0.1.0.10 app/helpers/c80_yax/frontend/catalog_index_helper.rb