Sha256: 92af50ed50cbfcc53f998b2fbb1c9472b2ba873fdaaad86fe2a6702e0273d311

Contents?: true

Size: 660 Bytes

Versions: 11

Compression:

Stored size: 660 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.event.participant_form_fields.order(position: :asc).map(&:title).map do |key|
      { Tramway::Event::Participant.human_attribute_name(key).to_sym => -> { values&.dig(key) } }
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
tramway-event-2.0.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-2.0.0.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-2.0 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.9.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.9 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.8.2 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.8.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.8 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.7 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.6.4 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.6.3 app/decorators/tramway/event/participant_xls_decorator.rb