Merge pull request #6011 from betagouv/display-pdf-export-on-two-columns

Export PDF : les valeurs des champs sont maintenant affichés sur deux colonnes (#6011)
This commit is contained in:
Pierre de La Morinerie 2021-03-23 17:11:33 +01:00 committed by GitHub
commit 909f1ba9ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,9 +93,9 @@ def render_single_champ(pdf, champ)
end
pdf.text "\n"
when 'Champs::ExplicationChamp'
format_in_2_lines(pdf, champ.libelle, champ.description)
format_in_2_columns(pdf, champ.libelle, champ.description)
when 'Champs::CarteChamp'
format_in_2_lines(pdf, champ.libelle, champ.to_feature_collection.to_json)
format_in_2_columns(pdf, champ.libelle, champ.to_feature_collection.to_json)
when 'Champs::SiretChamp'
pdf.font 'marianne', style: :bold, size: 9 do
pdf.text champ.libelle
@ -105,10 +105,10 @@ def render_single_champ(pdf, champ)
pdf.text "\n"
when 'Champs::NumberChamp'
value = number_with_delimiter(champ.to_s)
format_in_2_lines(pdf, champ.libelle, value)
format_in_2_columns(pdf, champ.libelle, value)
else
value = champ.to_s.empty? ? 'Non communiqué' : champ.to_s
format_in_2_lines(pdf, champ.libelle, value)
format_in_2_columns(pdf, champ.libelle, value)
end
end
@ -181,7 +181,7 @@ prawn_document(page_size: "A4") do |pdf|
pdf.text "Ce dossier est <b>#{dossier_display_state(@dossier, lower: true)}</b>.", inline_format: true
pdf.text "\n"
if @dossier.motivation.present?
format_in_2_lines(pdf, "Motif de la décision", @dossier.motivation)
format_in_2_columns(pdf, "Motif de la décision", @dossier.motivation)
end
add_title(pdf, 'Historique')
add_etats_dossier(pdf, @dossier)