From 7ef1a558f412b1af5476ec631da497ecdac3b76f Mon Sep 17 00:00:00 2001 From: pedong Date: Wed, 5 Jun 2019 17:07:38 +0200 Subject: [PATCH] change date format for all, use try_format_date of helper --- app/views/admin/procedures/_list.html.haml | 4 ++-- .../administrateur_mailer/activate_before_expiration.haml | 2 +- .../procedure_administrateurs/_administrateur.html.haml | 2 +- app/views/shared/dossiers/_champ_row.html.haml | 2 +- app/views/shared/dossiers/_identite_individual.html.haml | 2 +- app/views/shared/dossiers/_pieces_jointes.html.haml | 4 ++-- app/views/shared/dossiers/_submit_is_over.html.haml | 2 +- .../shared/dossiers/editable_champs/_champ_label.html.haml | 2 +- app/views/users/dossiers/index.html.haml | 2 +- spec/views/shared/dossiers/_demande.html.haml_spec.rb | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/views/admin/procedures/_list.html.haml b/app/views/admin/procedures/_list.html.haml index 39f9a4a4a..833a6a6fc 100644 --- a/app/views/admin/procedures/_list.html.haml +++ b/app/views/admin/procedures/_list.html.haml @@ -20,9 +20,9 @@ - if procedure.publiee? %td.procedure-lien= link_to(procedure_lien(procedure), procedure_lien(procedure)) - if procedure.publiee_ou_archivee? - %td= link_to(procedure.published_at.present? ? procedure.published_at.strftime('%d/%m/%Y %H:%M') : "", admin_procedure_href) + %td= link_to(procedure.published_at.present? ? try_format_datetime(procedure.published_at) : "", admin_procedure_href) - else - %td= link_to(procedure.created_at.strftime('%d/%m/%Y %H:%M'), admin_procedure_href) + %td= link_to(try_format_datetime(procedure.created_at), admin_procedure_href) %td = link_to('Cloner', admin_procedure_clone_path(procedure.id), data: { method: :put }, class: 'btn-sm btn-primary clone-btn') - if !procedure.publiee_ou_archivee? diff --git a/app/views/administrateur_mailer/activate_before_expiration.haml b/app/views/administrateur_mailer/activate_before_expiration.haml index 6f60a52cc..a5e0bea12 100644 --- a/app/views/administrateur_mailer/activate_before_expiration.haml +++ b/app/views/administrateur_mailer/activate_before_expiration.haml @@ -5,7 +5,7 @@ %p Vous avez fait la demande d’un compte administrateur sur demarches-simplifiees.fr. - Votre compte a été créé mais reste inactif, il arrivera à expiration le #{@expiration_date.strftime("%d/%m/%Y")} + Votre compte a été créé mais reste inactif, il arrivera à expiration le #{try_format_date(@expiration_date)} %p Afin d’activer votre compte, veuillez cliquer sur le lien ci-dessous : diff --git a/app/views/new_administrateur/procedure_administrateurs/_administrateur.html.haml b/app/views/new_administrateur/procedure_administrateurs/_administrateur.html.haml index 65354f432..9277ae0ad 100644 --- a/app/views/new_administrateur/procedure_administrateurs/_administrateur.html.haml +++ b/app/views/new_administrateur/procedure_administrateurs/_administrateur.html.haml @@ -1,6 +1,6 @@ %tr{ id: "procedure-#{@procedure.id}-administrateur-#{administrateur.id}" } %td= administrateur.email - %td= administrateur.created_at.strftime('%d/%m/%Y %H:%M') + %td= try_format_datetime(administrateur.created_at) %td= administrateur.registration_state %td - if administrateur == current_administrateur diff --git a/app/views/shared/dossiers/_champ_row.html.haml b/app/views/shared/dossiers/_champ_row.html.haml index e59716d6b..66d5b4807 100644 --- a/app/views/shared/dossiers/_champ_row.html.haml +++ b/app/views/shared/dossiers/_champ_row.html.haml @@ -41,4 +41,4 @@ %td.updated-at %span{ class: highlight_if_unseen_class(demande_seen_at, c.updated_at) } modifié le - = c.updated_at.strftime("%d/%m/%Y à %H:%M") + = try_format_datetime(c.updated_at) diff --git a/app/views/shared/dossiers/_identite_individual.html.haml b/app/views/shared/dossiers/_identite_individual.html.haml index c1d08eb5d..7f83da051 100644 --- a/app/views/shared/dossiers/_identite_individual.html.haml +++ b/app/views/shared/dossiers/_identite_individual.html.haml @@ -12,4 +12,4 @@ - if individual.birthdate.present? %tr %th.libelle Date de naissance : - %td= individual.birthdate&.strftime("%d/%m/%Y") + %td= try_format_date(individual.birthdate) diff --git a/app/views/shared/dossiers/_pieces_jointes.html.haml b/app/views/shared/dossiers/_pieces_jointes.html.haml index f547c6f72..c11777fb4 100644 --- a/app/views/shared/dossiers/_pieces_jointes.html.haml +++ b/app/views/shared/dossiers/_pieces_jointes.html.haml @@ -23,11 +23,11 @@ = link_to pj.content_url, { target: :blank, rel: :noopener } do %span.filename= display_pj_filename(pj) %span - ajoutée le #{pj.created_at.strftime('%d/%m/%Y à %H:%M')} + ajoutée le #{try_format_datetime(pj.created_at)} - else %td Pièce non fournie %td.updated-at - if pj %span{ class: highlight_if_unseen_class(demande_seen_at, pj.updated_at) } modifié le - = pj.updated_at.strftime("%d/%m/%Y à %H:%M") + = try_format_datetime(pj.updated_at) diff --git a/app/views/shared/dossiers/_submit_is_over.html.haml b/app/views/shared/dossiers/_submit_is_over.html.haml index 9d81a8a96..212f6e00f 100644 --- a/app/views/shared/dossiers/_submit_is_over.html.haml +++ b/app/views/shared/dossiers/_submit_is_over.html.haml @@ -3,6 +3,6 @@ .card-title Le dépôt de dossier est fermé - if dossier.procedure.archived_at.present? - Il n'est plus possible de déposer de dossier pour cette démarche en ligne depuis le #{dossier.procedure.archived_at.strftime("%d/%m/%Y")}. + Il n'est plus possible de déposer de dossier pour cette démarche en ligne depuis le #{try_format_date(dossier.procedure.archived_at)}. - else Il n'est plus possible de déposer de dossier pour cette démarche en ligne. diff --git a/app/views/shared/dossiers/editable_champs/_champ_label.html.haml b/app/views/shared/dossiers/editable_champs/_champ_label.html.haml index 43c6d2b11..1800c94bb 100644 --- a/app/views/shared/dossiers/editable_champs/_champ_label.html.haml +++ b/app/views/shared/dossiers/editable_champs/_champ_label.html.haml @@ -5,7 +5,7 @@ - if champ.updated_at.present? && seen_at.present? %span.updated-at{ class: highlight_if_unseen_class(seen_at, champ.updated_at) } - = "modifié le #{champ.updated_at.strftime('%d/%m/%Y à %H:%M')}" + = "modifié le #{try_format_datetime(champ.updated_at)}" - if champ.description.present? %span.notice= string_to_html(champ.description) diff --git a/app/views/users/dossiers/index.html.haml b/app/views/users/dossiers/index.html.haml index 8d49cd044..9475432c3 100644 --- a/app/views/users/dossiers/index.html.haml +++ b/app/views/users/dossiers/index.html.haml @@ -47,7 +47,7 @@ = render partial: 'shared/dossiers/status_badge', locals: { dossier: dossier } %td.updated-at-col = link_to(url_for_dossier(dossier), class: 'cell-link') do - = dossier.updated_at.strftime("%d/%m/%Y") + = try_format_date(dossier.updated_at) %td.action-col.action-col = render partial: 'dossier_actions', locals: { dossier: dossier } = paginate(@dossiers) diff --git a/spec/views/shared/dossiers/_demande.html.haml_spec.rb b/spec/views/shared/dossiers/_demande.html.haml_spec.rb index 4c1a7d796..c1d28dd72 100644 --- a/spec/views/shared/dossiers/_demande.html.haml_spec.rb +++ b/spec/views/shared/dossiers/_demande.html.haml_spec.rb @@ -38,7 +38,7 @@ describe 'shared/dossiers/demande.html.haml', type: :view do expect(rendered).to include(individual.gender) expect(rendered).to include(individual.nom) expect(rendered).to include(individual.prenom) - expect(rendered).to include(individual.birthdate.strftime("%d/%m/%Y")) + expect(rendered).to include(I18n.l(individual.birthdate)) end end