Sha256: 05e475966c5aa0b0212306151be2a147a5848aefbb778dd81f73f21b25fef1d1

Contents?: true

Size: 1.34 KB

Versions: 31

Compression:

Stored size: 1.34 KB

Contents

# Used on the Event Registrations tickets step

class EffectiveEventRegistrantsDatatable < Effective::Datatable
  datatable do

    col :name do |er|
      "#{er.first_name} #{er.last_name}<br><small>#{mail_to(er.email)}</small>"
    end

    col :event_ticket, search: :string, label: 'Ticket' do |er|
      [
        er.event_ticket.to_s,
        (content_tag(:span, 'Archived', class: 'badge badge-warning') if er.event_ticket&.archived?)
      ].compact.join('<br>').html_safe
    end

    col :first_name, visible: false
    col :last_name, visible: false
    col :email, visible: false
    col :company, visible: false
    col :number, visible: false, label: 'Designations'

    col :notes

    col :price, as: :price

    col :archived, visible: false

    # no actions_col
  end

  collection do
    scope = Effective::EventRegistrant.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_by_id(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

31 entries across 31 versions & 1 rubygems

Version Path
effective_events-0.11.3 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.11.2 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.11.1 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.11.0 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.10.2 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.10.1 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.10.0 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.9.3 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.9.2 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.9.1 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.9.0 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.8.0 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.7.4 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.7.3 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.7.2 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.7.1 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.7.0 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.6.13 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.6.12 app/datatables/effective_event_registrants_datatable.rb
effective_events-0.6.11 app/datatables/effective_event_registrants_datatable.rb