Files
openfoodnetwork/app/components/product_component.rb
Jean-Baptiste Bellet 7692cebbd3 Create Product component
Update product_component.html.haml
2022-12-07 15:08:52 +01:00

12 lines
324 B
Ruby

# frozen_string_literal: true
class ProductComponent < ViewComponentReflex::Component
def initialize(product:, columns:)
@columns = columns
@image = product.images[0] if product.images.any?
@name = product.name
@unit = "#{product.unit_value} #{product.variant_unit}"
@price = product.price
end
end