Class: Tramway::Event::ParticipantXlsDecorator

Inherits:
Tramway::Export::Xls::ApplicationDecorator
  • Object
show all
Defined in:
app/decorators/tramway/event/participant_xls_decorator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.columnsObject



5
6
7
8
9
# File 'app/decorators/tramway/event/participant_xls_decorator.rb', line 5

def columns
  %i[event].map do |attribute|
    { Tramway::Event::Participant.human_attribute_name(attribute).to_sym => attribute }
  end
end

.filenameObject



11
12
13
# File 'app/decorators/tramway/event/participant_xls_decorator.rb', line 11

def filename
  'participants.xls'
end

Instance Method Details

#eventObject



18
19
20
# File 'app/decorators/tramway/event/participant_xls_decorator.rb', line 18

def event
  object.event.title
end

#flexible_columnsObject



22
23
24
25
26
# File 'app/decorators/tramway/event/participant_xls_decorator.rb', line 22

def flexible_columns
  object.event.participant_form_fields.order(position: :asc).map(&:title).map do |key|
    { Tramway::Event::Participant.human_attribute_name(key).to_sym => -> { values&.dig(key) } }
  end
end