18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/helpers/effective_events_helper.rb', line 18
def effective_events_event_products_collection(event)
raise('expected an Effective::Event') unless event.kind_of?(Effective::Event)
event.event_products.reject(&:archived?).map do |product|
title = product.to_s
price = (product.price == 0 ? '$0' : price_to_currency(product.price))
remaining = (product.capacity.present? ? "#{product.capacity_available} remaining" : nil)
label = [title, price, remaining].compact.join(' - ')
disabled = { disabled: :disabled } unless product.available?
[label, product.to_param, disabled].compact
end
end
|