Sha256: 6d6041b48d43ecc7c5f0457a3e8567f39c221ff3d8d369e781feb10eb59e62e2

Contents?: true

Size: 609 Bytes

Versions: 8

Compression:

Stored size: 609 Bytes

Contents

# frozen_string_literal: true

class Tramway::Event::ParticipantXlsDecorator < Tramway::Export::Xls::ApplicationDecorator
  class << self
    def columns
      %i[event].map do |attribute|
        { Tramway::Event::Participant.human_attribute_name(attribute).to_sym => attribute }
      end
    end

    def filename
      'participants.xls'
    end
  end

  delegate :values, to: :object

  def event
    object.event.title
  end

  def flexible_columns
    object.values&.keys&.map do |key|
      { Tramway::Event::Participant.human_attribute_name(key).to_sym => -> { values&.dig(key) } }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
tramway-event-1.11.4.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.11.4 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.11.2.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.11.2 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.11.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.11.0.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.11 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.10.2 app/decorators/tramway/event/participant_xls_decorator.rb