Sha256: baf4c1a5ae5108bd1da5b632a24527fb1d7c4b9bc69b9bfd6de570b57abd78e7

Contents?: true

Size: 1.11 KB

Versions: 12

Compression:

Stored size: 1.11 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_by_id(attributes[:event_id])
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
effective_events-0.6.9 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.8 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.7 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.6 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.5 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.4 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.3 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.2 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.1 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.6.0 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.5.6 app/datatables/admin/effective_event_registrants_datatable.rb
effective_events-0.5.5 app/datatables/admin/effective_event_registrants_datatable.rb