Merge pull request #7339 from tchak/fix-add-back-export-all
feat(dossiers): bring back export all dossiers
This commit is contained in:
commit
84d2e38494
8 changed files with 18 additions and 11 deletions
|
@ -1,5 +1,5 @@
|
|||
class Dossiers::ExportComponent < ApplicationComponent
|
||||
def initialize(procedure:, exports:, statut:, count:)
|
||||
def initialize(procedure:, exports:, statut: nil, count: nil)
|
||||
@procedure = procedure
|
||||
@exports = exports
|
||||
@statut = statut
|
||||
|
|
|
@ -7,6 +7,7 @@ en:
|
|||
everything_short: Ask an export in format%{export_format}
|
||||
everything_pending_html: Ask an export in format %{export_format} is being generated<br>(ask %{export_time} ago)
|
||||
everything_ready_html: Download the export in format %{export_format}<br>(generated %{export_time} ago)
|
||||
download_all: Download all files
|
||||
download:
|
||||
one: Download a file
|
||||
other: Download %{count} files
|
||||
|
|
|
@ -7,6 +7,7 @@ fr:
|
|||
everything_short: Demander un export au format %{export_format}
|
||||
everything_pending_html: Un export au format %{export_format} est en train d’être généré<br>(demandé il y a %{export_time})
|
||||
everything_ready_html: Télécharger l’export au format %{export_format}<br>(généré 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
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
%span.dropdown{ data: { controller: 'menu-button' } }
|
||||
%button.button.dropdown-button{ data: { menu_button_target: 'button' } }
|
||||
= t(".download", count: @count)
|
||||
- if @count.nil?
|
||||
= t(".download_all")
|
||||
- else
|
||||
= t(".download", count: @count)
|
||||
#download-menu.dropdown-content.fade-in-down{ style: 'width: 450px', data: { menu_button_target: 'menu' } }
|
||||
%ul.dropdown-items{ 'data-turbo': 'true' }
|
||||
- exports.each do |item|
|
||||
- export = item[:export]
|
||||
%li
|
||||
- if export.nil?
|
||||
// i18n-tasks-use t('.everything_csv_html')
|
||||
// i18n-tasks-use t('.everything_xlsx_html')
|
||||
// i18n-tasks-use t('.everything_ods_html')
|
||||
// i18n-tasks-use t('.everything_zip_html')
|
||||
= link_to t(".everything_#{item[:format]}_html"), download_export_path(export_format: item[:format]), data: { turbo_method: :post }
|
||||
- elsif export.ready?
|
||||
= link_to ready_link_label(export), export.file.service_url, target: "_blank", rel: "noopener"
|
||||
|
|
|
@ -49,9 +49,7 @@ class Export < ApplicationRecord
|
|||
after_create_commit :compute_async
|
||||
|
||||
FORMATS_WITH_TIME_SPAN = [:xlsx, :ods, :csv].flat_map do |format|
|
||||
time_span_types.keys.map do |time_span_type|
|
||||
{ format: format, time_span_type: time_span_type }
|
||||
end
|
||||
[{ format: format, time_span_type: 'everything' }]
|
||||
end
|
||||
FORMATS = [:xlsx, :ods, :csv, :zip].map do |format|
|
||||
{ format: format }
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
= render partial: 'header', locals: { procedure: @procedure, statut: @statut }
|
||||
|
||||
.procedure-actions
|
||||
- if @can_download_dossiers
|
||||
= render Dossiers::ExportComponent.new(procedure: @procedure, exports: @exports)
|
||||
|
||||
.container.flex= render partial: "tabs", locals: { procedure: @procedure,
|
||||
statut: @statut,
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
- if @can_download_dossiers
|
||||
= turbo_stream.update_all '.dossiers-export' do
|
||||
= render Dossiers::ExportComponent.new(procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count)
|
||||
- if @statut.nil?
|
||||
= turbo_stream.update_all '.procedure-actions' do
|
||||
= render Dossiers::ExportComponent.new(procedure: @procedure, exports: @exports)
|
||||
- else
|
||||
= turbo_stream.update_all '.dossiers-export' do
|
||||
= render Dossiers::ExportComponent.new(procedure: @procedure, exports: @exports, statut: @statut, count: @dossiers_count)
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
= render partial: 'header', locals: { procedure: @procedure, statut: @statut }
|
||||
|
||||
.procedure-actions
|
||||
- if @can_download_dossiers
|
||||
= render Dossiers::ExportComponent.new(procedure: @procedure, exports: @exports)
|
||||
|
||||
.container.flex= render partial: "tabs", locals: { procedure: @procedure,
|
||||
statut: @statut,
|
||||
|
|
Loading…
Reference in a new issue