Sha256: e8c685f5ec22a5d29d47f2346e75eeca3c0e54be145ce2ddef67926193162841

Contents?: true

Size: 701 Bytes

Versions: 5

Compression:

Stored size: 701 Bytes

Contents

# frozen_string_literal: true

class Tramway::Event::PartakingDecorator < ::Tramway::Core::ApplicationDecorator
  class << self
    def collections
      [:all]
    end

    def show_attributes
      %i[part_name event_duration part_description]
    end
  end

  delegate_attributes :position
  decorate_association :part

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

  def part_name
    part.name
  end

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tramway-event-1.12.9.1 app/decorators/tramway/event/partaking_decorator.rb
tramway-event-1.12.9 app/decorators/tramway/event/partaking_decorator.rb
tramway-event-1.12.8.2 app/decorators/tramway/event/partaking_decorator.rb
tramway-event-1.12.8.1 app/decorators/tramway/event/partaking_decorator.rb
tramway-event-1.12.8 app/decorators/tramway/event/partaking_decorator.rb