Sha256: 37b912c3d4a9f67d93ac192aee69adc51ffada71d6e62db894b0d9e620fd8177
Contents?: true
Size: 1.34 KB
Versions: 7
Compression:
Stored size: 1.34 KB
Contents
module EffectiveEventsHelper def effective_events_event_tickets_collection(event) raise('expected an Effective::Event') unless event.kind_of?(Effective::Event) event.event_tickets.reject(&:archived?).map do |ticket| title = ticket.to_s price = (ticket.price == 0 ? '$0' : price_to_currency(ticket.price)) remaining = (ticket.capacity.present? ? "#{ticket.capacity_available} remaining" : nil) label = [title, price, remaining].compact.join(' - ') disabled = { disabled: :disabled } unless ticket.available? [label, ticket.to_param, disabled].compact end end 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 def edit_effective_event_registrations_wizard? params[:controller] == 'effective/event_registrations' && defined?(resource) && resource.draft? end end
Version data entries
7 entries across 7 versions & 1 rubygems