Sha256: f1a6c351f4931465008abaf40765ed648f456ea7946c37a296a2d1bd288e02af

Contents?: true

Size: 695 Bytes

Versions: 3

Compression:

Stored size: 695 Bytes

Contents

# frozen_string_literal: true

class Tramway::Event::PartakingDecorator < ::Tramway::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

3 entries across 3 versions & 1 rubygems

Version Path
tramway-event-2.0.1 app/decorators/tramway/event/partaking_decorator.rb
tramway-event-2.0.0.1 app/decorators/tramway/event/partaking_decorator.rb
tramway-event-2.0 app/decorators/tramway/event/partaking_decorator.rb