Sha256: a2e3e3a284071a3396364db32cdf8db3f83e0e2ad264e0b38201f19001826638

Contents?: true

Size: 828 Bytes

Versions: 12

Compression:

Stored size: 828 Bytes

Contents

# Used on the Event Registrations Addons step

class EffectiveEventAddonsDatatable < Effective::Datatable
  datatable do

    col :event_product, search: :string, label: 'Product'
    col :price, as: :price
    # col :notes
    # no actions_col
  end

  collection do
    scope = Effective::EventAddon.deep.all

    if event.present?
      scope = scope.where(event: event)
    end

    if event_registration.present?
      scope = scope.where(event_registration_id: event_registration)
    end

    scope
  end

  def event
    @event ||= if attributes[:event_id]
      Effective::Event.find(attributes[:event_id])
    end
  end

  def event_registration
    @event_registration ||= if attributes[:event_registration_id]
      EffectiveEvents.EventRegistration.find_by_id(attributes[:event_registration_id])
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
effective_events-0.2.8 app/datatables/effective_event_addons_datatable.rb
effective_events-0.2.7 app/datatables/effective_event_addons_datatable.rb
effective_events-0.2.6 app/datatables/effective_event_addons_datatable.rb
effective_events-0.2.5 app/datatables/effective_event_addons_datatable.rb
effective_events-0.2.4 app/datatables/effective_event_addons_datatable.rb
effective_events-0.2.3 app/datatables/effective_event_addons_datatable.rb
effective_events-0.2.2 app/datatables/effective_event_addons_datatable.rb
effective_events-0.2.1 app/datatables/effective_event_addons_datatable.rb
effective_events-0.2.0 app/datatables/effective_event_addons_datatable.rb
effective_events-0.1.10 app/datatables/effective_event_addons_datatable.rb
effective_events-0.1.9 app/datatables/effective_event_addons_datatable.rb
effective_events-0.1.8 app/datatables/effective_event_addons_datatable.rb