Sha256: 11bd38e6f96188bafe83e6b51c8ea2b960ba4d4a3f66e840f07ee31d27ba4a20

Contents?: true

Size: 797 Bytes

Versions: 3

Compression:

Stored size: 797 Bytes

Contents

fields = %w(
  person_type
  first_name
  last_name
  name
  short_name
  email
  phone
  mobile
  fax
  skype
  www
  twitter
  facebook
  linkedin
  viadeo
  legal_form
  capital
  immatriculation_number_1
  immatriculation_number_2
  european_union_vat_number
  address.street
  address.street_bis
  address.city
  address.zip
  address.country
)

data = []

data << fields.map { |field| model.t(field) }

@people_without_pagination.each do |person|
  line = []

  fields.each do |field|
    if field == "person_type"
      line << person.class.t
    elsif field.include?("address.")
      line << person.address.public_send(field.gsub("address.", ""))
    else
      line << person.public_send(:try, field)
    end
  end

  data << line
end

Dorsale::Serializers::XLSX.new(data).render_inline

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dorsale-3.4.0 app/views/dorsale/customer_vault/people/index.xlsx.ruby
dorsale-3.3.0 app/views/dorsale/customer_vault/people/index.xlsx.ruby
dorsale-3.2.0 app/views/dorsale/customer_vault/people/index.xlsx.ruby