mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-19 05:09:38 +02:00
Improve account internal linking and redirect behavior (#864)
* Fix transaction row link and overflow * Allow user to access imports from account page * Clean up accounts controller, add link to account page from settings * Add link to accounts management from accounts summary page * Cleanup styles
This commit is contained in:
parent
8372e26864
commit
c5704ffd45
12 changed files with 86 additions and 62 deletions
|
@ -2,7 +2,7 @@ class AccountsController < ApplicationController
|
|||
layout "with_sidebar"
|
||||
|
||||
include Filterable
|
||||
before_action :set_account, only: %i[ show update destroy sync ]
|
||||
before_action :set_account, only: %i[ show destroy sync update ]
|
||||
|
||||
def index
|
||||
@accounts = Current.family.accounts
|
||||
|
@ -32,26 +32,9 @@ class AccountsController < ApplicationController
|
|||
@valuation_series = @account.valuations.to_series
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @account.update(account_params.except(:accountable_type))
|
||||
|
||||
@account.sync_later if account_params[:is_active] == "1" && @account.can_sync?
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to accounts_path, notice: t(".success") }
|
||||
format.turbo_stream do
|
||||
render turbo_stream: [
|
||||
turbo_stream.append("notification-tray", partial: "shared/notification", locals: { type: "success", content: { body: t(".success") } }),
|
||||
turbo_stream.replace("account_#{@account.id}", partial: "accounts/account", locals: { account: @account })
|
||||
]
|
||||
end
|
||||
end
|
||||
else
|
||||
render "show", status: :unprocessable_entity
|
||||
end
|
||||
@account.update! account_params.except(:accountable_type)
|
||||
redirect_back_or_to account_path(@account), notice: t(".success")
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -62,7 +45,7 @@ class AccountsController < ApplicationController
|
|||
@valuation = @account.valuations.new(date: account_params[:start_date] || Date.today, value: @account.balance, currency: @account.currency)
|
||||
@valuation.save!
|
||||
|
||||
redirect_to accounts_path, notice: t(".success")
|
||||
redirect_to account_path(@account), notice: t(".success")
|
||||
else
|
||||
render "new", status: :unprocessable_entity
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue