chore(exports): minor wording improvements and clarifications

This commit is contained in:
Colin Darie 2023-09-21 13:59:14 +02:00
parent ec46faf690
commit d9687f7418
No known key found for this signature in database
GPG key ID: 8C76CADD40253590
12 changed files with 36 additions and 54 deletions

View file

@ -23,18 +23,17 @@ class Dossiers::ExportLinkComponent < ApplicationComponent
if export.available?
t(".ready_link_label_time_info", export_time: helpers.time_ago_in_words(export.updated_at))
else
t(".not_ready_link_label_time_info", export_time: helpers.time_ago_in_words(export.updated_at))
t(".not_ready_link_label_time_info", export_time: helpers.time_ago_in_words(export.created_at))
end
end
def export_title(export)
count = export.count
case count
when nil
t(".export_title", export_tabs: human_export_status(export), export_format: export.format)
if export.procedure_presentation_id.nil?
t(".export_title_everything", export_format: export.format)
elsif export.tous?
t(".export_title", export_format: export.format, count: export.count)
else
t(".export_title_counted", export_tabs: human_export_status(export), export_format: export.format, count: count)
t(".export_title_with_tab", export_tabs: human_export_status(export), export_format: export.format, count: export.count)
end
end
@ -56,8 +55,7 @@ class Dossiers::ExportLinkComponent < ApplicationComponent
def export_button(export)
if export.available?
title = t(".everything_ready", export_format: ".#{export.format}")
render Dsfr::DownloadComponent.new(attachment: export.file, name: title)
render Dsfr::DownloadComponent.new(attachment: export.file, name: t('.download_export'))
elsif export.pending?
content_tag(:a, t('.refresh_page'), { href: "", class: 'fr-btn fr-btn--sm fr-btn--tertiary' })
end

View file

@ -1,27 +1,17 @@
---
en:
everything_csv_html: Request an export in .csv format<br>(only files, without repeatable fields)
everything_xlsx_html: Request an export in .xlsx format
everything_ods_html: Request an export in .ods format
everything_zip_html: Request an export in .zip format<br>(does not contains timestamp nor operation logs)
everything_json_html: Request an export in .json format (GeoJSON)
everything_short: Request an export in %{export_format} format
download_export: Download export
refresh_old_export: Regenerate this export
everything_ready: Download export %{export_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:
export_title_everything: Export .%{export_format} of all files
export_title_with_tab:
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
download:
one: Download a file
other: Download %{count} files
macros_doc:
title: "Macros documentation"
url: "https://doc.demarches-simplifiees.fr/pour-aller-plus-loin/exports-et-macros"
export_title:
one: Export .%{export_format} of 1 file
other: Export .%{export_format} of %{count} files
ready_link_label_time_info: " generated %{export_time} ago"
not_ready_link_label_time_info: " asked %{export_time} ago"

View file

@ -1,27 +1,17 @@
---
fr:
everything_csv_html: Demander un export au format .csv<br>(uniquement les dossiers, sans les champs répétables)
everything_xlsx_html: Demander un export au format .xlsx
everything_ods_html: Demander un export au format .ods
everything_zip_html: Demander un export au format .zip<br>(ne contient pas l'horodatage ni le journal de log)
everything_json_html: Demander un export au format .json (GeoJSON)
everything_short: Demander un export au format %{export_format}
download_export: Télécharger lexport
refresh_old_export: Regénérer cet export
everything_ready: Télécharger lexport %{export_format}
success_label: Prêt
failed_label: Erreur
pending_label: En préparation
refresh_page: Recharger la page
export_title: "Export .%{export_format} des dossiers « %{export_tabs} »"
export_title_counted:
export_title_everything: "Export .%{export_format} de tous les dossiers"
export_title_with_tab:
one: "Export .%{export_format} dun dossier « %{export_tabs} »"
other: "Export .%{export_format} de %{count} dossiers « %{export_tabs} »"
export_title:
one: "Export .%{export_format} dun dossier"
other: "Export .%{export_format} de %{count} dossiers"
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
other: Télécharger %{count} dossiers
macros_doc:
title: "documentation sur les macros"
url: "https://doc.demarches-simplifiees.fr/pour-aller-plus-loin/exports-et-macros"

View file

@ -6,7 +6,7 @@ module Administrateurs
helper_method :create_archive_url
def index
@exports = Export.by_key(all_groupe_instructeurs.map(&:id), nil)
@exports = Export.ante_chronological.by_key(all_groupe_instructeurs.map(&:id), nil)
@average_dossier_weight = @procedure.average_dossier_weight
@count_dossiers_termines_by_month = @procedure.dossiers.processed_by_month(all_groupe_instructeurs).count
@archives = Archive.for_groupe_instructeur(all_groupe_instructeurs).to_a

View file

@ -226,7 +226,7 @@ module Instructeurs
def exports
@procedure = procedure
@exports = Export.for_groupe_instructeurs(groupe_instructeur_ids).order(updated_at: :desc)
@exports = Export.for_groupe_instructeurs(groupe_instructeur_ids).ante_chronological
cookies.encrypted[cookies_export_key] = {
value: DateTime.current,
expires: Export::MAX_DUREE_GENERATION + Export::MAX_DUREE_CONSERVATION_EXPORT

View file

@ -34,6 +34,8 @@ class Export < ApplicationRecord
validates :format, :groupe_instructeurs, :key, presence: true
scope :ante_chronological, -> { order(updated_at: :desc) }
after_create_commit :compute_async
FORMATS_WITH_TIME_SPAN = [:xlsx, :ods, :csv].flat_map do |format|

View file

@ -9,7 +9,7 @@
%h1= t('.title')
= render Dsfr::CalloutComponent.new(title: nil) do |c|
- c.with_body do
%p= t('.export_description')
%p= t('.export_description', expiration_time: Export::MAX_DUREE_CONSERVATION_EXPORT.in_hours.to_i)
- if @exports.present?
%div{ data: @exports.any?(&:pending?) ? { controller: "turbo-poll", turbo_poll_url_value: "", turbo_poll_interval_value: 10_000, turbo_poll_max_checks_value: 6 } : {} }

View file

@ -5,5 +5,7 @@ en:
export_pending_html: We generate this export. You will be able to download it in a few minutes from <a href="%{url}">the exports list</a>.
exports:
title: Exports list
export_description: This list of exports contains the last exports you requested as well as those requested by instructors belonging to the same group.
no_export_html: You have no export at the moment. <br> Can't find an export? It may have expired, exports are deleted after %{expiration_time} hours.
export_description: |
This list of exports contains the last exports you requested as well as those requested by instructors belonging to the same group.
They are available for %{expiration_time} hours after generation.
no_export_html: You have no export at the moment. <br> Can't find an export? It may have expired, exports are deleted after %{expiration_time} hours.

View file

@ -5,5 +5,7 @@ fr:
export_pending_html: Nous générons cet export. Vous pourrez le télécharger dans quelques minutes depuis <a href="%{url}">la liste des exports</a>.
exports:
title: Liste des exports
export_description: Cette liste d'exports contient les derniers exports que vous avez demandés ainsi que ceux demandés par les instructeurs appartenant au même groupe.
export_description: |
Cette liste d'exports contient les derniers exports que vous avez demandés ainsi que ceux demandés par les instructeurs appartenant au même groupe.
Ils sont disponibles pendant %{expiration_time} heures après leur génération.
no_export_html: Vous n'avez pas d'export pour le moment. <br> Vous ne trouvez pas un export ? Il a peut-être expiré, les exports sont supprimés au bout de %{expiration_time} heures.

View file

@ -23,5 +23,3 @@ fr:
title: "%{procedure_libelle} - n°%{procedure_id} - administrateurs"
stats:
title: Statistiques
exports:
title: Exports

View file

@ -1,7 +1,7 @@
RSpec.describe Dossiers::ExportLinkComponent, type: :component do
let(:procedure) { create(:procedure) }
let(:groupe_instructeur) { create(:groupe_instructeur, procedure: procedure) }
let(:export) { create(:export, groupe_instructeurs: [groupe_instructeur], updated_at: 5.minutes.ago) }
let(:export) { create(:export, groupe_instructeurs: [groupe_instructeur], updated_at: 5.minutes.ago, created_at: 10.minutes.ago) }
let(:export_url) { double("ExportUrl", call: "/some/fake/path") }
let(:component) { described_class.new(procedure:, exports: [export], export_url:) }
@ -34,7 +34,7 @@ RSpec.describe Dossiers::ExportLinkComponent, type: :component do
end
it "displays the pending label" do
expect(subject).to include("demandé il y a 5 minutes")
expect(subject).to include("demandé il y a 10 minutes")
end
it "displays a refresh page button" do

View file

@ -130,7 +130,7 @@ describe 'Instructing a dossier:', js: true, retry: 3 do
end
page.driver.browser.navigate.refresh
expect(page).to have_text('Télécharger lexport .csv')
expect(page).to have_text('Télécharger lexport')
end
scenario 'A instructeur can see the personnes impliquées' do