Class: Tramway::Event::PartakingDecorator

Inherits:
ApplicationDecorator
  • Object
show all
Defined in:
app/decorators/tramway/event/partaking_decorator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.collectionsObject



5
6
7
# File 'app/decorators/tramway/event/partaking_decorator.rb', line 5

def collections
  [:all]
end

.show_attributesObject



9
10
11
# File 'app/decorators/tramway/event/partaking_decorator.rb', line 9

def show_attributes
  %i[part_name event_duration part_description]
end

Instance Method Details

#event_durationObject



25
26
27
28
29
30
31
# File 'app/decorators/tramway/event/partaking_decorator.rb', line 25

def event_duration
  if part.respond_to? :duration
    part.duration
  else
    part.event.duration
  end
end

#nameObject



17
18
19
# File 'app/decorators/tramway/event/partaking_decorator.rb', line 17

def name
  "#{object.person.first_name} #{object.person.last_name} - #{object.position}"
end

#part_descriptionObject



33
34
35
# File 'app/decorators/tramway/event/partaking_decorator.rb', line 33

def part_description
  raw part.respond_to?(:description) ? part.description : part.event.description
end

#part_nameObject



21
22
23
# File 'app/decorators/tramway/event/partaking_decorator.rb', line 21

def part_name
  part.name
end