Sha256: 3d66d6156a7c8bc5e310c688e658c3228ed37839dc1a26b6f84dc417a14f04e2

Contents?: true

Size: 667 Bytes

Versions: 22

Compression:

Stored size: 667 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.active.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

22 entries across 22 versions & 1 rubygems

Version Path
tramway-event-1.12.6.2 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.6 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.5 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.4 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3.10 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3.9 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3.8 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3.7 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3.6 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3.5 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3.4 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3.3 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3.2 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.3 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.2 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.1.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12.0.1 app/decorators/tramway/event/participant_xls_decorator.rb
tramway-event-1.12 app/decorators/tramway/event/participant_xls_decorator.rb