Retours de code review

- message_date_with_year systématique pour les messages
 - tous les commentaires sont affiché
 - gestion du champ 'Explication'
This commit is contained in:
clemkeirua 2019-12-16 11:43:44 +01:00
parent cf385e326c
commit 18e21f75c9

View file

@ -23,9 +23,7 @@ def add_title(pdf, title)
end end
def format_date(date) def format_date(date)
is_current_year = (date.year == Time.zone.today.year) I18n.l(date, format: :message_date_with_year)
template = is_current_year ? :message_date : :message_date_with_year
I18n.l(date, format: template)
end end
def add_identite_individual(pdf, dossier) def add_identite_individual(pdf, dossier)
@ -84,6 +82,8 @@ def render_single_champ(pdf, champ)
pdf.text champ.libelle pdf.text champ.libelle
end end
pdf.text "\n" pdf.text "\n"
when 'Champs::ExplicationChamp'
format_in_2_lines(pdf, champ.libelle, champ.description)
when 'Champs::CarteChamp' when 'Champs::CarteChamp'
format_in_2_lines(pdf, champ.libelle, champ.geo_json.to_s) format_in_2_lines(pdf, champ.libelle, champ.geo_json.to_s)
when 'Champs::SiretChamp' when 'Champs::SiretChamp'
@ -180,7 +180,7 @@ prawn_document(page_size: "A4") do |pdf|
end end
add_title(pdf, 'Messagerie') add_title(pdf, 'Messagerie')
@dossier.commentaires.with_attached_piece_jointe.each do |commentaire| @dossier.commentaires.each do |commentaire|
add_message(pdf, commentaire) add_message(pdf, commentaire)
end end
end end