display last export alert in view
This commit is contained in:
parent
968b2cfb0a
commit
f34090f8fd
6 changed files with 36 additions and 4 deletions
|
@ -1,13 +1,13 @@
|
|||
.fr-mb-5v
|
||||
- if @batch.finished_at.present?
|
||||
= render Dsfr::AlertComponent.new(title: t(".title.finish"), state: (@batch.errors? ? :warning : :success), heading_level: 'h2') do |c|
|
||||
= render Dsfr::AlertComponent.new(title: t(".title.finish"), state: (@batch.errors? ? :warning : :success), heading_level: 'h2', extra_class_names: 'fr-my-2w') do |c|
|
||||
- c.body do
|
||||
%p
|
||||
= t(".#{batch.operation}.finish.text_success", count: @batch.total_count, success_count: @batch.success_count)
|
||||
|
||||
|
||||
- else
|
||||
= render Dsfr::AlertComponent.new(title: t(".title.in_progress"), state: :info, heading_level: 'h2') do |c|
|
||||
= render Dsfr::AlertComponent.new(title: t(".title.in_progress"), state: :info, heading_level: 'h2', extra_class_names: 'fr-my-2w') do |c|
|
||||
- c.body do
|
||||
%p= t(".#{batch.operation}.in_progress.text_success", count: @batch.total_count, success_count: @batch.success_count)
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ module Instructeurs
|
|||
@not_archived_notifications_dossier_ids = notifications[:en_cours] + notifications[:termines]
|
||||
|
||||
@has_export_notification = notify_exports?
|
||||
@has_last_export = last_export_for(@statut)
|
||||
|
||||
@filtered_sorted_ids = procedure_presentation.filtered_sorted_ids(dossiers, statut, count: dossiers_count)
|
||||
|
||||
|
@ -181,6 +182,8 @@ module Instructeurs
|
|||
@statut = export_options[:statut]
|
||||
@dossiers_count = export.count
|
||||
|
||||
@has_last_export = last_export_for(@statut)
|
||||
|
||||
if export.available?
|
||||
respond_to do |format|
|
||||
format.turbo_stream do
|
||||
|
@ -377,6 +380,10 @@ module Instructeurs
|
|||
scope.exists?
|
||||
end
|
||||
|
||||
def last_export_for(statut)
|
||||
Export.for_groupe_instructeurs(groupe_instructeur_ids).where(statut: statut).last
|
||||
end
|
||||
|
||||
def cookies_export_key
|
||||
"exports_#{@procedure.id}_seen_at"
|
||||
end
|
||||
|
|
|
@ -26,3 +26,14 @@
|
|||
= link_to t('instructeurs.dossiers.header.banner.exports_list'), exports_instructeur_procedure_path(procedure), class: 'header-link'
|
||||
- if @has_export_notification
|
||||
%span.notifications{ 'aria-label': t('instructeurs.dossiers.header.banner.exports_notification_label') }
|
||||
|
||||
|
||||
#last-export-alert
|
||||
- if @has_last_export.present?
|
||||
= render Dsfr::AlertComponent.new(state: :info, size: :sm, extra_class_names: 'fr-my-2w') do |c|
|
||||
- c.body do
|
||||
%p
|
||||
- if @has_last_export.pending?
|
||||
= t('instructeurs.procedures.last_export_pending')
|
||||
- else
|
||||
= t('instructeurs.procedures.last_export_available_html', file_format: @has_last_export.format, file_url: @has_last_export.file.url)
|
||||
|
|
|
@ -6,3 +6,13 @@
|
|||
- else
|
||||
= turbo_stream.update_all '.dossiers-export' do
|
||||
= render Dossiers::ExportDropdownComponent.new(procedure: @procedure, statut: @statut, count: @dossiers_count, export_url: method(:download_export_instructeur_procedure_path))
|
||||
|
||||
= turbo_stream.replace "last-export-alert" do
|
||||
- if @has_last_export.present?
|
||||
= render Dsfr::AlertComponent.new(state: :info, size: :sm, extra_class_names: 'fr-my-2w') do |c|
|
||||
- c.body do
|
||||
%p
|
||||
- if @has_last_export.pending?
|
||||
= t('instructeurs.procedures.last_export_pending')
|
||||
- else
|
||||
= t('instructeurs.procedures.last_export_available_html', file_format: @has_last_export.format, file_url: @has_last_export.file.url)
|
||||
|
|
|
@ -2,7 +2,9 @@ en:
|
|||
instructeurs:
|
||||
procedures:
|
||||
export_available_html: The export in %{file_format} format is ready. You can <a href="%{file_url}">download</a>
|
||||
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>.
|
||||
export_pending_html: We generate this export. You can refresh this page or go to <a href="%{url}">the exports list</a>.
|
||||
last_export_available_html: Your last export in %{file_format} format is ready. You can <a href="%{file_url}">download</a>
|
||||
last_export_pending: Your last export is in process. Please refresh this page.
|
||||
exports:
|
||||
title: Exports list
|
||||
export_description: |
|
||||
|
|
|
@ -2,7 +2,9 @@ fr:
|
|||
instructeurs:
|
||||
procedures:
|
||||
export_available_html: L’export au format %{file_format} est prêt. Vous pouvez le <a href="%{file_url}">télécharger</a>
|
||||
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>.
|
||||
export_pending_html: Nous générons cet export. Veuillez rafraichir la page ou vous rendre sur <a href="%{url}">la liste des exports</a>.
|
||||
last_export_available_html: Votre dernier export au format %{file_format} est prêt. Vous pouvez le <a href="%{file_url}">télécharger</a>
|
||||
last_export_pending: Votre dernier export est en cours de création. Veuillez rafraichir la page.
|
||||
exports:
|
||||
title: Liste des exports
|
||||
export_description: |
|
||||
|
|
Loading…
Reference in a new issue