feat(exports): name the dossiers count

This commit is contained in:
Colin Darie 2023-09-20 12:22:43 +02:00
parent c7cd5d2189
commit ed057737a5
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
5 changed files with 26 additions and 14 deletions

View file

@ -31,9 +31,14 @@ class Dossiers::ExportLinkComponent < ApplicationComponent
end
def export_title(export)
t(".export_title",
export_tabs: export.statut.to_s,
export_format: export.format)
count = export.count
case count
when nil
t(".export_title", export_tabs: export.statut.to_s, export_format: export.format)
else
t(".export_title_counted", export_tabs: export.statut.to_s, export_format: export.format, count: count)
end
end
def badge(export)

View file

@ -7,12 +7,15 @@ en:
everything_json_html: Request an export in .json format (GeoJSON)
everything_short: Request an export in %{export_format} format
refresh_old_export: Recreate this export
everything_ready: Download the export in %{export_format} format
everything_ready: Download in %{export_format} format
success_label: Ready
failed_label: Failed
pending_label: In progress
refresh_page: Refresh page
export_title: Export .%{export_format} for files « %{export_tabs} »
export_title_counted:
one: Export .%{export_format} of 1 file « %{export_tabs} »
other: Export .%{export_format} of %{count} files « %{export_tabs} »
ready_link_label_time_info: " - generated %{export_time} ago"
not_ready_link_label_time_info: " - asked %{export_time} ago"
download_all: Download all files

View file

@ -7,14 +7,17 @@ fr:
everything_json_html: Demander un export au format .json (GeoJSON)
everything_short: Demander un export au format %{export_format}
refresh_old_export: Recréer cet export
everything_ready: Télécharger lexport au format %{export_format}
everything_ready: Télécharger au format %{export_format}
success_label: Prêt
failed_label: Erreur
pending_label: En cours
pending_label: En préparation
refresh_page: Recharger la page
export_title: Export .%{export_format} pour les dossiers « %{export_tabs} »
ready_link_label_time_info: " - généré il y a %{export_time}"
not_ready_link_label_time_info: " - demandé il y a %{export_time}"
export_title: "Export .%{export_format} des dossiers « %{export_tabs} »"
export_title_counted:
one: "Export .%{export_format} dun dossier « %{export_tabs} »"
other: "Export .%{export_format} de %{count} dossiers « %{export_tabs} »"
ready_link_label_time_info: " généré il y a %{export_time}"
not_ready_link_label_time_info: " demandé il y a %{export_time}"
download_all: Télécharger tous les dossiers
download:
one: Télécharger un dossier

View file

@ -2,10 +2,11 @@
- @exports.each do |export|
%li.fr-mb-3w
.flex
%strong
= export_title(export)
%span.fr-text-mention--grey.fr-mb-1w
= time_info(export)
%span
%strong
= export_title(export)
%span.fr-text-mention--grey.fr-mb-1w
= time_info(export)
.fr-ml-auto
= badge(export)
%ul.fr-btns-group.fr-btns-group--inline-sm

View file

@ -114,7 +114,7 @@ class Export < ApplicationRecord
def count
if procedure_presentation_id.present?
dossiers_for_export.size
dossiers_for_export.count
end
end