Skip to content

Commit

Permalink
chore(exports): minor wording improvements and clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
colinux committed Sep 21, 2023
1 parent fec9a08 commit 2cdd0cc
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 54 deletions.
16 changes: 7 additions & 9 deletions app/components/dossiers/export_link_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,17 @@ def time_info(export)
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

Expand All @@ -56,8 +55,7 @@ def badge(export)

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
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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 l’export
refresh_old_export: Regénérer cet export
everything_ready: Télécharger l’export %{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} d’un dossier « %{export_tabs} »"
other: "Export .%{export_format} de %{count} dossiers « %{export_tabs} »"
export_title:
one: "Export .%{export_format} d’un 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"
2 changes: 1 addition & 1 deletion app/controllers/administrateurs/archives_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ArchivesController < AdministrateurController
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
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/instructeurs/procedures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def stats

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
Expand Down
2 changes: 2 additions & 0 deletions app/models/export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
2 changes: 1 addition & 1 deletion app/views/instructeurs/procedures/exports.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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 } : {} }
Expand Down
6 changes: 4 additions & 2 deletions config/locales/views/instructeurs/procedures/exports/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
4 changes: 3 additions & 1 deletion config/locales/views/instructeurs/procedures/exports/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
2 changes: 0 additions & 2 deletions config/locales/views/instructeurs/procedures/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ fr:
title: "%{procedure_libelle} - n°%{procedure_id} - administrateurs"
stats:
title: Statistiques
exports:
title: Exports
4 changes: 2 additions & 2 deletions spec/components/dossiers/export_link_component_spec.rb
Original file line number Diff line number Diff line change
@@ -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:) }
Expand Down Expand Up @@ -34,7 +34,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion spec/system/instructeurs/instruction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
end

page.driver.browser.navigate.refresh
expect(page).to have_text('Télécharger l’export .csv')
expect(page).to have_text('Télécharger l’export')
end

scenario 'A instructeur can see the personnes impliquées' do
Expand Down

0 comments on commit 2cdd0cc

Please sign in to comment.