Sha256: 906f68c998f7f9ac33a6924023ab0b72b189520fe1e4f73fee8712854f314774

Contents?: true

Size: 531 Bytes

Versions: 3

Compression:

Stored size: 531 Bytes

Contents

module Workarea
  module Storefront
    module ContentBlocks
      class InsightsGridCellViewModel < ProductInsightsViewModel
        include GridContent

        def products
          super.first(number_of_products)
        end

        def sub_grid_cell_class
          if data[:width] == '2'
            'grid__cell--50-at-medium'
          end
        end

        private

        def number_of_products
          (data[:width].presence || 1).to_i * (data[:height].presence || 1).to_i
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
workarea-product_grid_content-1.4.0 app/view_models/workarea/storefront/content_blocks/insights_grid_cell_view_model.rb
workarea-product_grid_content-1.3.1 app/view_models/workarea/storefront/content_blocks/insights_grid_cell_view_model.rb
workarea-product_grid_content-1.3.0 app/view_models/workarea/storefront/content_blocks/insights_grid_cell_view_model.rb