Skip to content

Commit 3fb379d

Browse files
committed
Sync family icon button
1 parent d90d35d commit 3fb379d

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

app/controllers/accounts_controller.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ def index
99
render layout: "settings"
1010
end
1111

12+
def sync_all
13+
family.sync_later
14+
redirect_to accounts_path, notice: "Syncing accounts..."
15+
end
16+
1217
def show
1318
@chart_view = params[:chart_view] || "balance"
1419
@tab = params[:tab]

app/views/accounts/index.html.erb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
<h1 class="text-xl"><%= t(".accounts") %></h1>
33
<div class="flex items-center gap-5">
44
<div class="flex items-center gap-2">
5+
<%= icon(
6+
"refresh-cw",
7+
as_button: true,
8+
size: "sm",
9+
href: sync_all_accounts_path,
10+
disabled: Current.family.syncing?,
11+
frame: :_top
12+
) %>
513
<%= render DS::Link.new(
614
text: "New account",
715
href: new_account_path(return_to: accounts_path),

config/routes.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@
162162
get :sparkline
163163
patch :toggle_active
164164
end
165+
166+
collection do
167+
post :sync_all
168+
end
165169
end
166170

167171
# Convenience routes for polymorphic paths

0 commit comments

Comments
 (0)