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

Add loan and credit card views (#1268)

* Add loan and credit card views

* Lint fix

* Clean up overview card markup

* Lint fix

* Test fix
This commit is contained in:
Zach Gollwitzer 2024-10-08 17:16:37 -04:00 committed by GitHub
parent 9263dd3bbe
commit fd941d714d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 564 additions and 102 deletions

View file

@ -1,4 +1,9 @@
module AccountsHelper
def summary_card(title:, &block)
content = capture(&block)
render "accounts/summary_card", title: title, content: content
end
def to_accountable_title(accountable)
accountable.model_name.human
end
@ -31,6 +36,10 @@ module AccountsHelper
properties_path
when "Vehicle"
vehicles_path
when "Loan"
loans_path
when "CreditCard"
credit_cards_path
else
accounts_path
end
@ -42,6 +51,10 @@ module AccountsHelper
property_path(account)
when "Vehicle"
vehicle_path(account)
when "Loan"
loan_path(account)
when "CreditCard"
credit_card_path(account)
else
account_path(account)
end
@ -58,6 +71,7 @@ module AccountsHelper
return [ value_tab ] if account.other_asset? || account.other_liability?
return [ overview_tab, value_tab ] if account.property? || account.vehicle?
return [ holdings_tab, cash_tab, trades_tab ] if account.investment?
return [ overview_tab, value_tab, transactions_tab ] if account.loan? || account.credit_card?
[ value_tab, transactions_tab ]
end