From 46226b7930309ae6f914da244bdd5d0748a24d17 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 7 Sep 2021 15:33:25 +0200 Subject: [PATCH] fix(i18n): use size instead of count in dossier mailers --- app/mailers/dossier_mailer.rb | 14 +++++++------- ..._automatic_deletion_to_administration.html.haml | 2 +- .../notify_automatic_deletion_to_user.html.haml | 4 ++-- .../notify_brouillon_deletion.html.haml | 2 +- .../notify_brouillon_near_deletion.html.haml | 4 ++-- ...otify_near_deletion_to_administration.html.haml | 8 ++++---- .../notify_near_deletion_to_user.html.haml | 8 ++++---- app/views/dossier_mailer/notify_transfer.html.haml | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/app/mailers/dossier_mailer.rb b/app/mailers/dossier_mailer.rb index e21e28bfc..fb3dc35a6 100644 --- a/app/mailers/dossier_mailer.rb +++ b/app/mailers/dossier_mailer.rb @@ -67,7 +67,7 @@ class DossierMailer < ApplicationMailer def notify_brouillon_near_deletion(dossiers, to_email) I18n.with_locale(dossiers.first.user_locale) do - @subject = default_i18n_subject(count: dossiers.count) + @subject = default_i18n_subject(count: dossiers.size) @dossiers = dossiers mail(to: to_email, subject: @subject) @@ -75,7 +75,7 @@ class DossierMailer < ApplicationMailer end def notify_brouillon_deletion(dossier_hashes, to_email) - @subject = default_i18n_subject(count: dossier_hashes.count) + @subject = default_i18n_subject(count: dossier_hashes.size) @dossier_hashes = dossier_hashes mail(to: to_email, subject: @subject) @@ -109,7 +109,7 @@ class DossierMailer < ApplicationMailer def notify_automatic_deletion_to_user(deleted_dossiers, to_email) I18n.with_locale(deleted_dossiers.first.user_locale) do @state = deleted_dossiers.first.state - @subject = default_i18n_subject(count: deleted_dossiers.count) + @subject = default_i18n_subject(count: deleted_dossiers.size) @deleted_dossiers = deleted_dossiers mail(to: to_email, subject: @subject) @@ -117,7 +117,7 @@ class DossierMailer < ApplicationMailer end def notify_automatic_deletion_to_administration(deleted_dossiers, to_email) - @subject = default_i18n_subject(count: deleted_dossiers.count) + @subject = default_i18n_subject(count: deleted_dossiers.size) @deleted_dossiers = deleted_dossiers mail(to: to_email, subject: @subject) @@ -126,7 +126,7 @@ class DossierMailer < ApplicationMailer def notify_near_deletion_to_user(dossiers, to_email) I18n.with_locale(dossiers.first.user_locale) do @state = dossiers.first.state - @subject = default_i18n_subject(count: dossiers.count, state: @state) + @subject = default_i18n_subject(count: dossiers.size, state: @state) @dossiers = dossiers mail(to: to_email, subject: @subject) @@ -135,7 +135,7 @@ class DossierMailer < ApplicationMailer def notify_near_deletion_to_administration(dossiers, to_email) @state = dossiers.first.state - @subject = default_i18n_subject(count: dossiers.count, state: @state) + @subject = default_i18n_subject(count: dossiers.size, state: @state) @dossiers = dossiers mail(to: to_email, subject: @subject) @@ -159,7 +159,7 @@ class DossierMailer < ApplicationMailer def notify_transfer(transfer) I18n.with_locale(transfer.user_locale) do - @subject = default_i18n_subject(count: transfer.dossiers.count) + @subject = default_i18n_subject(count: transfer.dossiers.size) @transfer = transfer mail(to: transfer.email, subject: @subject) diff --git a/app/views/dossier_mailer/notify_automatic_deletion_to_administration.html.haml b/app/views/dossier_mailer/notify_automatic_deletion_to_administration.html.haml index 286f30134..7d2cb3e91 100644 --- a/app/views/dossier_mailer/notify_automatic_deletion_to_administration.html.haml +++ b/app/views/dossier_mailer/notify_automatic_deletion_to_administration.html.haml @@ -3,7 +3,7 @@ %p= t(:hello, scope: [:views, :shared, :greetings]) %p - = t('.header', count: @deleted_dossiers.count) + = t('.header', count: @deleted_dossiers.size) %ul - @deleted_dossiers.each do |d| %li n° #{d.dossier_id} (#{d.procedure.libelle}) diff --git a/app/views/dossier_mailer/notify_automatic_deletion_to_user.html.haml b/app/views/dossier_mailer/notify_automatic_deletion_to_user.html.haml index afbfc3fac..8dcb3ea1a 100644 --- a/app/views/dossier_mailer/notify_automatic_deletion_to_user.html.haml +++ b/app/views/dossier_mailer/notify_automatic_deletion_to_user.html.haml @@ -3,12 +3,12 @@ %p= t(:hello, scope: [:views, :shared, :greetings]) %p - = t('.header', count: @deleted_dossiers.count) + = t('.header', count: @deleted_dossiers.size) %ul - @deleted_dossiers.each do |d| %li n° #{d.dossier_id} (#{d.procedure.libelle}) - if @state == Dossier.states.fetch(:en_construction) - %p= t('.footer_en_construction', count: @deleted_dossiers.count) + %p= t('.footer_en_construction', count: @deleted_dossiers.size) = render partial: "layouts/mailers/signature" diff --git a/app/views/dossier_mailer/notify_brouillon_deletion.html.haml b/app/views/dossier_mailer/notify_brouillon_deletion.html.haml index 4461c9c98..a6b1312d1 100644 --- a/app/views/dossier_mailer/notify_brouillon_deletion.html.haml +++ b/app/views/dossier_mailer/notify_brouillon_deletion.html.haml @@ -3,7 +3,7 @@ %p= t(:hello, scope: [:views, :shared, :greetings]) %p - = t('.header', count: @dossier_hashes.count) + = t('.header', count: @dossier_hashes.size) %ul - @dossier_hashes.each do |d| %li n° #{d[:id]} (#{d[:procedure_libelle]}) diff --git a/app/views/dossier_mailer/notify_brouillon_near_deletion.html.haml b/app/views/dossier_mailer/notify_brouillon_near_deletion.html.haml index 450abf898..2b358eab6 100644 --- a/app/views/dossier_mailer/notify_brouillon_near_deletion.html.haml +++ b/app/views/dossier_mailer/notify_brouillon_near_deletion.html.haml @@ -3,11 +3,11 @@ %p= t(:hello, scope: [:views, :shared, :greetings]) %p - = t('.header', count: @dossiers.count) + = t('.header', count: @dossiers.size) %ul - @dossiers.each do |d| %li= link_to("n° #{d.id} (#{d.procedure.libelle})", dossier_url(d)) -%p= sanitize(t('.footer', count: @dossiers.count)) +%p= sanitize(t('.footer', count: @dossiers.size)) = render partial: "layouts/mailers/signature" diff --git a/app/views/dossier_mailer/notify_near_deletion_to_administration.html.haml b/app/views/dossier_mailer/notify_near_deletion_to_administration.html.haml index ff752e469..419aa8e91 100644 --- a/app/views/dossier_mailer/notify_near_deletion_to_administration.html.haml +++ b/app/views/dossier_mailer/notify_near_deletion_to_administration.html.haml @@ -4,9 +4,9 @@ %p - if @state == Dossier.states.fetch(:en_construction) - = t('.header_en_construction', count: @dossiers.count) + = t('.header_en_construction', count: @dossiers.size) - else - = t('.header_termine', count: @dossiers.count) + = t('.header_termine', count: @dossiers.size) %ul - @dossiers.each do |d| %li @@ -14,8 +14,8 @@ %p - if @state == Dossier.states.fetch(:en_construction) - = sanitize(t('.footer_en_construction', count: @dossiers.count)) + = sanitize(t('.footer_en_construction', count: @dossiers.size)) - else - = sanitize(t('.footer_termine', count: @dossiers.count)) + = sanitize(t('.footer_termine', count: @dossiers.size)) = render partial: "layouts/mailers/signature" diff --git a/app/views/dossier_mailer/notify_near_deletion_to_user.html.haml b/app/views/dossier_mailer/notify_near_deletion_to_user.html.haml index d888955fe..f0d0c4c03 100644 --- a/app/views/dossier_mailer/notify_near_deletion_to_user.html.haml +++ b/app/views/dossier_mailer/notify_near_deletion_to_user.html.haml @@ -4,18 +4,18 @@ %p - if @state == Dossier.states.fetch(:en_construction) - = t('.header_en_construction', count: @dossiers.count) + = t('.header_en_construction', count: @dossiers.size) - else - = t('.header_termine', count: @dossiers.count) + = t('.header_termine', count: @dossiers.size) %ul - @dossiers.each do |d| %li #{link_to("n° #{d.id} (#{d.procedure.libelle})", dossier_url(d))}. Retrouvez le dossier au format #{link_to("PDF", dossier_url(d, format: :pdf))} %p - = sanitize(t('.footer', count: @dossiers.count)) + = sanitize(t('.footer', count: @dossiers.size)) %p - if @state == Dossier.states.fetch(:en_construction) - = sanitize(t('.footer_en_construction', count: @dossiers.count)) + = sanitize(t('.footer_en_construction', count: @dossiers.size)) = render partial: "layouts/mailers/signature" diff --git a/app/views/dossier_mailer/notify_transfer.html.haml b/app/views/dossier_mailer/notify_transfer.html.haml index 45887ad34..1f322afba 100644 --- a/app/views/dossier_mailer/notify_transfer.html.haml +++ b/app/views/dossier_mailer/notify_transfer.html.haml @@ -3,7 +3,7 @@ %p= t(:hello, scope: [:views, :shared, :greetings]) %p - = t('.body', count: @transfer.dossiers.count) + = t('.body', count: @transfer.dossiers.size) = link_to t('.transfer_link'), dossiers_url(statut: 'dossiers-transferes') = render partial: "layouts/mailers/signature"