add link to export page in flash message for instructeur
This commit is contained in:
parent
a867c9a998
commit
282df1b44b
7 changed files with 20 additions and 14 deletions
|
@ -10,7 +10,7 @@ module Administrateurs
|
||||||
if export.available?
|
if export.available?
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.turbo_stream do
|
format.turbo_stream do
|
||||||
flash.notice = export.flash_message
|
flash.notice = t('.export_available_html', file_format: export.format, file_url: export.file.url)
|
||||||
end
|
end
|
||||||
|
|
||||||
format.html do
|
format.html do
|
||||||
|
@ -21,11 +21,11 @@ module Administrateurs
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.turbo_stream do
|
format.turbo_stream do
|
||||||
if !params[:no_progress_notification]
|
if !params[:no_progress_notification]
|
||||||
flash.notice = export.flash_message
|
flash.notice = t('.export_pending')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
format.html do
|
format.html do
|
||||||
redirect_to admin_procedure_archives_url(@procedure), notice: export.flash_message
|
redirect_to admin_procedure_archives_url(@procedure), notice: t('.export_pending')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -181,7 +181,7 @@ module Instructeurs
|
||||||
if export.available?
|
if export.available?
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.turbo_stream do
|
format.turbo_stream do
|
||||||
flash.notice = export.flash_message
|
flash.notice = t('.export_available_html', file_format: export.format, file_url: export.file.url)
|
||||||
end
|
end
|
||||||
|
|
||||||
format.html do
|
format.html do
|
||||||
|
@ -192,11 +192,11 @@ module Instructeurs
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.turbo_stream do
|
format.turbo_stream do
|
||||||
if !params[:no_progress_notification]
|
if !params[:no_progress_notification]
|
||||||
flash.notice = export.flash_message
|
flash.notice = t('.export_pending_html', url: exports_instructeur_procedure_path(procedure))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
format.html do
|
format.html do
|
||||||
redirect_to exports_instructeur_procedure_path(procedure), notice: export.flash_message
|
redirect_to exports_instructeur_procedure_path(procedure), notice: t('.export_pending_html', url: exports_instructeur_procedure_path(procedure))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,14 +69,6 @@ class Export < ApplicationRecord
|
||||||
procedure_presentation_id.present?
|
procedure_presentation_id.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def flash_message
|
|
||||||
if available?
|
|
||||||
"L’export au format \"#{format}\" est prêt. Vous pouvez le <a href=\"#{file.url}\">télécharger</a>"
|
|
||||||
else
|
|
||||||
"Nous générons cet export. Veuillez revenir dans quelques minutes pour le télécharger."
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.find_or_create_export(format, groupe_instructeurs, time_span_type: time_span_types.fetch(:everything), statut: statuts.fetch(:tous), procedure_presentation: nil, force: false)
|
def self.find_or_create_export(format, groupe_instructeurs, time_span_type: time_span_types.fetch(:everything), statut: statuts.fetch(:tous), procedure_presentation: nil, force: false)
|
||||||
export = create_or_find_export(format, groupe_instructeurs, time_span_type: time_span_type, statut: statut, procedure_presentation: procedure_presentation)
|
export = create_or_find_export(format, groupe_instructeurs, time_span_type: time_span_type, statut: statut, procedure_presentation: procedure_presentation)
|
||||||
|
|
||||||
|
|
5
config/locales/views/administrateurs/exports/en.yml
Normal file
5
config/locales/views/administrateurs/exports/en.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
en:
|
||||||
|
administrateurs:
|
||||||
|
exports:
|
||||||
|
export_available_html: The export in %{file_format} format is ready. You can <a href="%{file_url}">download</a>
|
||||||
|
export_pending: We generate this export. Please come back in a few minutes to download it.
|
5
config/locales/views/administrateurs/exports/fr.yml
Normal file
5
config/locales/views/administrateurs/exports/fr.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
fr:
|
||||||
|
administrateurs:
|
||||||
|
exports:
|
||||||
|
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: Nous générons cet export. Veuillez revenir dans quelques minutes pour le télécharger.
|
|
@ -1,5 +1,7 @@
|
||||||
en:
|
en:
|
||||||
instructeurs:
|
instructeurs:
|
||||||
procedures:
|
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>.
|
||||||
exports:
|
exports:
|
||||||
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.
|
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.
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
fr:
|
fr:
|
||||||
instructeurs:
|
instructeurs:
|
||||||
procedures:
|
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>.
|
||||||
exports:
|
exports:
|
||||||
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.
|
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.
|
||||||
|
|
Loading…
Reference in a new issue