1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 13:19:39 +02:00

Consolidate and simplify account pages (#2462)
Some checks are pending
Publish Docker image / ci (push) Waiting to run
Publish Docker image / Build docker image (push) Blocked by required conditions

* Remove ScrollFocusable

* Consolidate and simplify account pages

* Lint fixes

* Fix tab param initialization

* Remove stale files

* Remove stale route, make accountable routes clearer
This commit is contained in:
Zach Gollwitzer 2025-07-18 05:52:18 -04:00 committed by GitHub
parent 3eea5a9891
commit 8c97c9d31a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
41 changed files with 252 additions and 269 deletions

View file

@ -1,5 +1,5 @@
class AccountsController < ApplicationController
before_action :set_account, only: %i[sync chart sparkline toggle_active]
before_action :set_account, only: %i[sync sparkline toggle_active show destroy]
include Periodable
def index
@ -9,6 +9,15 @@ class AccountsController < ApplicationController
render layout: "settings"
end
def show
@chart_view = params[:chart_view] || "balance"
@tab = params[:tab]
@q = params.fetch(:q, {}).permit(:search)
entries = @account.entries.search(@q).reverse_chronological
@pagy, @entries = pagy(entries, limit: params[:per_page] || "10")
end
def sync
unless @account.syncing?
@account.sync_later
@ -17,11 +26,6 @@ class AccountsController < ApplicationController
redirect_to account_path(@account)
end
def chart
@chart_view = params[:chart_view] || "balance"
render layout: "application"
end
def sparkline
etag_key = @account.family.build_cache_key("#{@account.id}_sparkline", invalidate_on_data_updates: true)
@ -42,6 +46,15 @@ class AccountsController < ApplicationController
redirect_to accounts_path
end
def destroy
if @account.linked?
redirect_to account_path(@account), alert: "Cannot delete a linked account"
else
@account.destroy_later
redirect_to accounts_path, notice: "Account scheduled for deletion"
end
end
private
def family
Current.family