fix(i18n): use size instead of count in dossier mailers

This commit is contained in:
Paul Chavard 2021-09-07 15:33:25 +02:00
parent d6cbdf2a48
commit 46226b7930
8 changed files with 22 additions and 22 deletions

View file

@ -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)

View file

@ -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})

View file

@ -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"

View file

@ -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]})

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -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"