Sha256: 1c863f75cbcc58597990363f6b440f17ecf4503a1a7ebd22a2677de256c9e5a5

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 KB

Contents

module Admin
  class EffectiveEventRegistrantsDatatable < Effective::Datatable
    filters do
      scope :unarchived, label: "All"
      scope :archived
    end

    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

10 entries across 10 versions & 1 rubygems

Version Path
effective_events-0.5.4 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.5.3 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.5.2 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.5.1 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.5.0 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.4.2 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.4.1 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.4.0 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.3.1 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.3.0 app/datatables/admin/effective_event_registrants_datatable.rb