style(exports): download link instead of button
This commit is contained in:
parent
307ba68970
commit
daa8eac9cc
4 changed files with 16 additions and 13 deletions
|
@ -61,16 +61,19 @@ class Dossiers::ExportLinkComponent < ApplicationComponent
|
||||||
def export_button(export)
|
def export_button(export)
|
||||||
if export.available?
|
if export.available?
|
||||||
title = t(".everything_ready", export_format: ".#{export.format}")
|
title = t(".everything_ready", export_format: ".#{export.format}")
|
||||||
content_tag(:a, title, { href: export.file.url, title: new_tab_suffix(title), target: "_blank", rel: "noopener", class: 'fr-btn' })
|
render Dsfr::DownloadComponent.new(attachment: export.file, name: title)
|
||||||
elsif export.pending?
|
elsif export.pending?
|
||||||
content_tag(:a, t('.refresh_page'), { href: "", class: 'fr-btn fr-btn fr-btn--tertiary' })
|
content_tag(:a, t('.refresh_page'), { href: "", class: 'fr-btn fr-btn--sm fr-btn--tertiary' })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def refresh_button_options(export)
|
def refresh_button_options(export)
|
||||||
{
|
{
|
||||||
title: t(".refresh_old_export", export_format: ".#{export.format}"),
|
title: t(".refresh_old_export", export_format: ".#{export.format}"),
|
||||||
class: "fr-btn fr-btn--tertiary"
|
"aria-label" => t(".refresh_old_export", export_format: ".#{export.format}"),
|
||||||
|
class: class_names("fr-btn fr-btn--sm fr-icon-refresh-line fr-btn--tertiary" => true,
|
||||||
|
"fr-btn--icon" => !export.failed?,
|
||||||
|
"fr-btn--icon-left" => export.failed?)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,8 +6,8 @@ en:
|
||||||
everything_zip_html: Request an export in .zip format<br>(does not contains timestamp nor operation logs)
|
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_json_html: Request an export in .json format (GeoJSON)
|
||||||
everything_short: Request an export in %{export_format} format
|
everything_short: Request an export in %{export_format} format
|
||||||
refresh_old_export: Recreate this export
|
refresh_old_export: Regenerate this export
|
||||||
everything_ready: Download in %{export_format} format
|
everything_ready: Download export %{export_format}
|
||||||
success_label: Ready
|
success_label: Ready
|
||||||
failed_label: Failed
|
failed_label: Failed
|
||||||
pending_label: In progress
|
pending_label: In progress
|
||||||
|
|
|
@ -6,8 +6,8 @@ fr:
|
||||||
everything_zip_html: Demander un export au format .zip<br>(ne contient pas l'horodatage ni le journal de log)
|
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_json_html: Demander un export au format .json (GeoJSON)
|
||||||
everything_short: Demander un export au format %{export_format}
|
everything_short: Demander un export au format %{export_format}
|
||||||
refresh_old_export: Recréer cet export
|
refresh_old_export: Regénérer cet export
|
||||||
everything_ready: Télécharger au format %{export_format}
|
everything_ready: Télécharger l’export %{export_format}
|
||||||
success_label: Prêt
|
success_label: Prêt
|
||||||
failed_label: Erreur
|
failed_label: Erreur
|
||||||
pending_label: En préparation
|
pending_label: En préparation
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
= time_info(export)
|
= time_info(export)
|
||||||
.fr-ml-auto
|
.fr-ml-auto
|
||||||
= badge(export)
|
= badge(export)
|
||||||
%ul.fr-btns-group.fr-btns-group--inline-sm
|
|
||||||
%li
|
|
||||||
= export_button(export)
|
|
||||||
|
|
||||||
- if export.old?
|
.flex.flex-gap-2
|
||||||
%li
|
= export_button(export)
|
||||||
= button_to refresh_button_options(export)[:title], download_export_path(export_format: export.format, statut: export.statut, force_export: true), refresh_button_options(export)
|
|
||||||
|
- if export.old? || export.failed?
|
||||||
|
= button_to refresh_button_options(export)[:title], download_export_path(export_format: export.format, statut: export.statut, force_export: true), refresh_button_options(export)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue