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[full_name email phone organization 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

#emailObject



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

def email
  return unless object.values

  object.values['Email']
end

#eventObject



40
41
42
# File 'app/decorators/tramway/event/participant_xls_decorator.rb', line 40

def event
  object.event.title
end

#full_nameObject



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

def full_name
  return unless object.values

  "#{object.values['Фамилия'] || object.values['Фамилия ']} #{object.values['Имя'] || object.values['Имя ']}"
end

#organizationObject



34
35
36
37
38
# File 'app/decorators/tramway/event/participant_xls_decorator.rb', line 34

def organization
  return unless object.values

  object.values['Место работы/ Учебное заведение']
end

#phoneObject



28
29
30
31
32
# File 'app/decorators/tramway/event/participant_xls_decorator.rb', line 28

def phone
  return unless object.values

  object.values['Телефон']
end