Sha256: 16834789f0a799e8bdfdfe10e63ac86b8e04434fec098e8e6396b19095959df6

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

module Admin
  class EffectiveEventRegistrantsDatatable < Effective::Datatable
    datatable do
      col :updated_at, visible: false
      col :created_at, visible: false
      col :id, visible: false

      col :event

      col :owner, visible: false
      col :event_registration, visible: false

      if attributes[:event_id]
        col :event_ticket, search: Effective::EventTicket.where(event: event).all
      else
        col :event_ticket, search: :string
      end

      col :purchased_order, visible: false

      col :first_name
      col :last_name
      col :email
      col :company
      col :number, label: 'Designations'
      col :notes, label: 'Restrictions and notes'

      actions_col
    end

    collection do
      scope = Effective::EventRegistrant.deep.purchased

      if attributes[:event_id].present?
        scope = scope.where(event: event)
      end

      scope
    end

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
effective_events-0.2.8 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.2.7 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.2.6 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.2.5 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.2.4 app/datatables/admin/effective_event_registrants_datatable.rb