Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

refactor: Exports section and updated translation files

Nuno Marques6ba0189e0743
diff --git a/app/views/family_exports/index.html.erb b/app/views/family_exports/index.html.erb
index f4bee6bdf3..8825e0856e 100644
--- a/app/views/family_exports/index.html.erb
+++ b/app/views/family_exports/index.html.erb
@@ -1,83 +1,124 @@
<%= settings_section title: t(".title") do %>
<div class="space-y-4">
- <% if @exports.empty? %>
- <p class="text-sm text-primary text-center py-4 mb-1 font-medium"><%= t(".no_exports") %></p>
- <% else %>
- <div class="bg-container rounded-lg shadow-border-xs">
- <% @exports.each do |export| %>
- <div class="flex items-center justify-between mx-4 py-4">
- <div class="flex items-center gap-2 mb-1">
- <div>
- <p class="text-sm font-medium text-primary"><%= t("family_exports.list.export_from", date: l(export.created_at, format: :long)) %></p>
- <p class="text-xs text-secondary"><%= export.filename %></p>
- </div>
-
- <% if export.processing? || export.pending? %>
- <span class="px-1 py text-xs rounded-full bg-gray-500/5 text-secondary border border-alpha-black-50">
- <%= t("family_exports.list.in_progress") %>
- </span>
- <% elsif export.completed? %>
- <span class="px-1 py text-xs rounded-full bg-green-500/5 text-green-500 border border-alpha-black-50">
- <%= t("family_exports.list.complete") %>
- </span>
- <% elsif export.failed? %>
- <span class="px-1 py text-xs rounded-full bg-red-500/5 text-red-500 border border-alpha-black-50">
- <%= t("family_exports.list.failed") %>
- </span>
- <% end %>
- </div>
+ <div class="rounded-xl bg-container-inset space-y-1 p-1">
+ <div class="flex items-center gap-1.5 px-4 py-2 text-xs font-medium text-secondary uppercase">
+ <p>
+ <%= t("family_exports.table.title") %>
+ </p>
+ <span class="text-subdued">&middot;</span>
+ <p><%= @exports.count %></p>
+ </div>
- <% if export.processing? || export.pending? %>
- <div class="flex items-center gap-2 text-secondary">
- <div class="animate-spin h-4 w-4 border-2 border-secondary border-t-transparent rounded-full"></div>
- <span class="text-sm"><%= t("family_exports.exporting") %></span>
- </div>
- <% elsif export.completed? %>
- <div class="flex items-center gap-2">
- <%= button_to family_export_path(export),
- method: :delete,
- class: "flex items-center gap-2 text-destructive hover:text-destructive-hover",
- data: {
- turbo_confirm: t("family_exports.delete_confirmation")
- } do %>
- <%= icon "trash-2", class: "w-5 h-5 text-destructive" %>
- <% end %>
+ <div class="bg-container rounded-lg shadow-border-xs overflow-x-auto">
+ <% if @exports.any? %>
+ <table class="w-full overflow-x-auto">
+ <thead>
+ <tr class="text-xs uppercase font-medium text-secondary border-b border-divider">
+ <th class="px-2 py-3 text-left min-w-44">
+ <%= t("family_exports.table.header.date") %>
+ </th>
+ <th class="px-2 py-3 text-left min-w-64">
+ <%= t("family_exports.table.header.filename") %>
+ </th>
+ <th class="px-2 py-3 text-left min-w-24">
+ <%= t("family_exports.table.header.status") %>
+ </th>
+ <th class="px-2 py-3 text-right min-w-20">
+ <%= t("family_exports.table.header.actions") %>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @exports.ordered.each do |export| %>
+ <tr class="border-b border-subdued hover:bg-surface-hover">
+ <td class="px-2 py-3">
+ <span class="text-sm text-secondary">
+ <%= export.created_at.strftime("%b %-d, %Y %l:%M %p") %>
+ </span>
+ </td>
+ <td class="px-2 py-3">
+ <span class="text-xs text-secondary truncate">
+ <%= export.filename %>
+ </span>
+ </td>
+ <td class="px-2 py-3">
+ <% if export.processing? || export.pending? %>
+ <%= render 'shared/badge' do %>
+ <%= t("family_exports.table.row.status.in_progress") %>
+ <% end %>
+ <% elsif export.completed? %>
+ <%= render 'shared/badge', color: 'success' do %>
+ <%= t("family_exports.table.row.status.complete") %>
+ <% end %>
+ <% elsif export.failed? %>
+ <%= render 'shared/badge', color: 'error' do %>
+ <%= t("family_exports.table.row.status.failed") %>
+ <% end %>
+ <% end %>
+ </td>
+ <td class="px-2 py-3 text-right">
+ <% if export.processing? || export.pending? %>
+ <div class="flex items-center justify-end gap-2 text-secondary">
+ <div class="animate-spin h-4 w-4 border-2 border-secondary border-t-transparent rounded-full"></div>
+ <span class="text-sm"><%= t("family_exports.exporting") %></span>
+ </div>
+ <% elsif export.completed? %>
+ <div class="flex items-center gap-2 justify-end">
+ <%= button_to family_export_path(export),
+ method: :delete,
+ class: "flex items-center gap-2 text-destructive hover:text-destructive-hover",
+ data: {
+ turbo_confirm: t("family_exports.delete_confirmation"),
+ turbo_frame: "_top"
+ } do %>
+ <%= icon "trash-2", class: "w-5 h-5 text-destructive" %>
+ <% end %>
- <%= link_to download_family_export_path(export),
- class: "flex items-center gap-2 text-primary hover:text-primary-hover" do %>
- <%= icon "download", class: "w-5 h-5" %>
- <% end %>
- </div>
- <% elsif export.failed? %>
- <div class="flex items-center gap-2">
- <div class="flex items-center gap-2 text-destructive">
- <%= icon "alert-circle", class: "w-4 h-4" %>
- </div>
+ <%= link_to download_family_export_path(export),
+ class: "flex items-center gap-2 text-primary hover:text-primary-hover",
+ data: { turbo_frame: "_top" } do %>
+ <%= icon "download", class: "w-5 h-5" %>
+ <% end %>
+ </div>
+ <% elsif export.failed? %>
+ <div class="flex items-center gap-2">
+ <div class="flex items-center gap-2 text-destructive">
+ <%= icon "alert-circle", class: "w-4 h-4" %>
+ </div>
- <%= button_to family_export_path(export),
- method: :delete,
- class: "flex items-center gap-2 text-destructive hover:text-destructive-hover",
- data: {
- turbo_confirm: t("family_exports.delete_failed_confirmation")
- } do %>
- <%= icon "trash-2", class: "w-5 h-5 text-destructive" %>
- <% end %>
- </div>
+ <%= button_to family_export_path(export),
+ method: :delete,
+ class: "flex items-center gap-2 text-destructive hover:text-destructive-hover",
+ data: {
+ turbo_confirm: t("family_exports.delete_failed_confirmation"),
+ turbo_frame: "_top"
+ } do %>
+ <%= icon "trash-2", class: "w-5 h-5 text-destructive" %>
+ <% end %>
+ </div>
+ <% end %>
+ </td>
+ </tr>
<% end %>
- </div>
+ </tbody>
+ </table>
+ <% else %>
+ <p class="text-sm text-secondary text-center py-8 font-medium">
+ <%= t("family_exports.table.empty") %>
+ </p>
<% end %>
</div>
+ </div>
- <% if @pagy.pages > 1 %>
- <div class="mt-4">
- <%= render "shared/pagination", pagy: @pagy %>
- </div>
- <% end %>
+ <% if @pagy.pages > 1 %>
+ <div class="mt-4">
+ <%= render "shared/pagination", pagy: @pagy %>
+ </div>
<% end %>
<%= link_to new_family_export_path,
- class: "bg-container-inset flex items-center justify-center gap-2 text-secondary mt-1 hover:bg-container-inset-hover rounded-lg px-4 py-2 w-full text-center",
- data: { turbo_frame: :modal } do %>
+ class: "bg-container-inset inline-flex items-center justify-center gap-2 hover:bg-container-inset-hover rounded-lg px-4 py-2 w-full font-medium text-primary text-sm text-center",
+ data: { turbo_frame: :modal } do %>
<%= icon("plus") %>
<%= t(".new") %>
<% end %>
diff --git a/config/locales/views/family_exports/ca.yml b/config/locales/views/family_exports/ca.yml
index a06d6edd3a..2e9ef233f9 100644
--- a/config/locales/views/family_exports/ca.yml
+++ b/config/locales/views/family_exports/ca.yml
@@ -13,10 +13,16 @@ ca:
index:
title: Exportacions
new: Nova exportació
- no_exports: Encara no hi ha exportacions.
- list:
- export_from: "Exportació del %{date}"
- in_progress: En curs
- complete: Completat
- failed: Error
- in_progress: En curs
+ table:
+ title: Exportacions
+ header:
+ date: Data
+ filename: Nom del fitxer
+ status: Estat
+ actions: Accions
+ row:
+ status:
+ in_progress: En curs
+ complete: Completat
+ failed: Error
+ empty: Encara no hi ha exportacions.
diff --git a/config/locales/views/family_exports/de.yml b/config/locales/views/family_exports/de.yml
index bb7a9353d1..bb0630dae3 100644
--- a/config/locales/views/family_exports/de.yml
+++ b/config/locales/views/family_exports/de.yml
@@ -13,9 +13,16 @@ de:
index:
title: Exporte
new: Neuer Export
- no_exports: Noch keine Exporte vorhanden.
- list:
- export_from: "Export vom %{date}"
- in_progress: Wird ausgeführt
- complete: Abgeschlossen
- failed: Fehlgeschlagen
+ table:
+ title: Exporte
+ header:
+ date: Datum
+ filename: Dateiname
+ status: Status
+ actions: Aktionen
+ row:
+ status:
+ in_progress: Wird ausgeführt
+ complete: Abgeschlossen
+ failed: Fehlgeschlagen
+ empty: Noch keine Exporte vorhanden.
diff --git a/config/locales/views/family_exports/en.yml b/config/locales/views/family_exports/en.yml
index 732cb9c1bf..8dd4512493 100644
--- a/config/locales/views/family_exports/en.yml
+++ b/config/locales/views/family_exports/en.yml
@@ -13,9 +13,16 @@ en:
index:
title: Exports
new: New Export
- no_exports: No exports yet.
- list:
- export_from: "Export from %{date}"
- in_progress: In progress
- complete: Complete
- failed: Failed
+ table:
+ title: Exports
+ header:
+ date: Date
+ filename: File name
+ status: Status
+ actions: Actions
+ row:
+ status:
+ in_progress: In progress
+ complete: Complete
+ failed: Failed
+ empty: No exports yet.
diff --git a/config/locales/views/family_exports/es.yml b/config/locales/views/family_exports/es.yml
index 5979c5349e..3079c01470 100644
--- a/config/locales/views/family_exports/es.yml
+++ b/config/locales/views/family_exports/es.yml
@@ -13,9 +13,16 @@ es:
index:
title: Exportaciones
new: Nueva exportación
- no_exports: Aún no hay exportaciones.
- list:
- export_from: "Exportación del %{date}"
- in_progress: En progreso
- complete: Completo
- failed: Fallido
+ table:
+ title: Exportaciones
+ header:
+ date: Fecha
+ filename: Nombre del archivo
+ status: Estado
+ actions: Acciones
+ row:
+ status:
+ in_progress: En progreso
+ complete: Completo
+ failed: Fallido
+ empty: Aún no hay exportaciones.
diff --git a/config/locales/views/family_exports/fr.yml b/config/locales/views/family_exports/fr.yml
index 57e2b790d4..29d9c9f221 100644
--- a/config/locales/views/family_exports/fr.yml
+++ b/config/locales/views/family_exports/fr.yml
@@ -1,7 +1,16 @@
---
fr:
family_exports:
- list:
- in_progress: En cours
- complete: Terminé
- failed: Échoué
+ table:
+ title: Exportations
+ header:
+ date: Date
+ filename: Nom de fichier
+ status: Statut
+ actions: Actions
+ row:
+ status:
+ in_progress: En cours
+ complete: Terminé
+ failed: Échoué
+ empty: Aucune exportation pour l'instant.
diff --git a/config/locales/views/family_exports/nb.yml b/config/locales/views/family_exports/nb.yml
index dc61e3ca04..e000982223 100644
--- a/config/locales/views/family_exports/nb.yml
+++ b/config/locales/views/family_exports/nb.yml
@@ -13,9 +13,16 @@ nb:
index:
title: Eksporter
new: Ny Eksport
- no_exports: Ingen eksporter ennå.
- list:
- export_from: "Eksport fra %{date}"
- in_progress: Pågår
- complete: Fullført
- failed: Mislykket
+ table:
+ title: Eksporter
+ header:
+ date: Dato
+ filename: Filnavn
+ status: Status
+ actions: Handlinger
+ row:
+ status:
+ in_progress: Pågår
+ complete: Fullført
+ failed: Mislykket
+ empty: Ingen eksporter ennå.
diff --git a/config/locales/views/family_exports/nl.yml b/config/locales/views/family_exports/nl.yml
index 2ea6a06641..6c8a2c55b6 100644
--- a/config/locales/views/family_exports/nl.yml
+++ b/config/locales/views/family_exports/nl.yml
@@ -1,7 +1,16 @@
---
nl:
family_exports:
- list:
- in_progress: Bezig
- complete: Voltooid
- failed: Mislukt
+ table:
+ title: Exporten
+ header:
+ date: Datum
+ filename: Bestandsnaam
+ status: Status
+ actions: Acties
+ row:
+ status:
+ in_progress: Bezig
+ complete: Voltooid
+ failed: Mislukt
+ empty: Nog geen export.
diff --git a/config/locales/views/family_exports/pt-BR.yml b/config/locales/views/family_exports/pt-BR.yml
index 6412e5c253..f21a10eb37 100644
--- a/config/locales/views/family_exports/pt-BR.yml
+++ b/config/locales/views/family_exports/pt-BR.yml
@@ -13,9 +13,16 @@ pt-BR:
index:
title: Exportações
new: Nova Exportação
- no_exports: Nenhuma exportação ainda.
- list:
- export_from: "Exportação de %{date}"
- in_progress: Em andamento
- complete: Concluído
- failed: Falhou
+ table:
+ title: Exportações
+ header:
+ date: Data
+ filename: Nome do ficheiro
+ status: Estado
+ actions: Ações
+ row:
+ status:
+ in_progress: Em andamento
+ complete: Concluído
+ failed: Falhou
+ empty: Nenhuma exportação ainda.
diff --git a/config/locales/views/family_exports/ro.yml b/config/locales/views/family_exports/ro.yml
index a698a2043e..cda6c5809a 100644
--- a/config/locales/views/family_exports/ro.yml
+++ b/config/locales/views/family_exports/ro.yml
@@ -13,9 +13,16 @@ ro:
index:
title: Exporturi
new: Export nou
- no_exports: Nu există încă exporturi.
- list:
- export_from: "Export din %{date}"
- in_progress: În curs de desfășurare
- complete: Finalizat
- failed: Eșuat
+ table:
+ title: Exporturi
+ header:
+ date: Data
+ filename: Nume de fișier
+ status: Stare
+ actions: Acțiuni
+ row:
+ status:
+ in_progress: În curs de desfășurare
+ complete: Finalizat
+ failed: Eșuat
+ empty: Nu există încă exporturi.
diff --git a/config/locales/views/family_exports/tr.yml b/config/locales/views/family_exports/tr.yml
index f62e43d32f..f6fc26a91b 100644
--- a/config/locales/views/family_exports/tr.yml
+++ b/config/locales/views/family_exports/tr.yml
@@ -13,9 +13,16 @@ tr:
index:
title: Dışa aktarmalar
new: Yeni Dışa Aktarma
- no_exports: Henüz hiç dışa aktarma yok.
- list:
- export_from: "%{date} tarihli dışa aktarma"
- in_progress: Devam ediyor
- complete: Tamamlandı
- failed: Başarısız
+ table:
+ title: Dışa aktarmalar
+ header:
+ date: Tarih
+ filename: Dosya adı
+ status: Durum
+ actions: Eylemler
+ row:
+ status:
+ in_progress: Devam ediyor
+ complete: Tamamlandı
+ failed: Başarısız
+ empty: Henüz hiç dışa aktarma yok.
diff --git a/config/locales/views/family_exports/zh-CN.yml b/config/locales/views/family_exports/zh-CN.yml
index 5373a5309b..2b211669a6 100644
--- a/config/locales/views/family_exports/zh-CN.yml
+++ b/config/locales/views/family_exports/zh-CN.yml
@@ -13,9 +13,16 @@ zh-CN:
index:
title: 导出
new: 新建导出
- no_exports: 暂无导出记录
- list:
- export_from: "导出自 %{date}"
- complete: 已完成
- failed: 已失败
- in_progress: 进行中
+ table:
+ title: 导出
+ header:
+ date: 日期
+ filename: 文件名
+ status: 地位
+ actions: 行动
+ row:
+ status:
+ complete: 已完成
+ failed: 已失败
+ in_progress: 进行中
+ empty: 暂无导出记录
diff --git a/config/locales/views/family_exports/zh-TW.yml b/config/locales/views/family_exports/zh-TW.yml
index 88d3e37007..4a0cb70da4 100644
--- a/config/locales/views/family_exports/zh-TW.yml
+++ b/config/locales/views/family_exports/zh-TW.yml
@@ -7,7 +7,16 @@ zh-TW:
destroy:
success: 匯出已成功刪除
export_not_ready: 匯出尚未準備好下載
- list:
- complete: 已完成
- failed: 已失敗
- in_progress: 進行中
+ table:
+ title: 出口
+ header:
+ date: 日期
+ filename: 檔案名稱
+ status: 地位
+ actions: 行動
+ row:
+ status:
+ in_progress: 進行中
+ complete: 已完成
+ failed: 已失敗
+ empty: 目前尚無出口記錄。