-
Notifications
You must be signed in to change notification settings - Fork 122
Cash Subtype Group on View #422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
69470cf
f5a8d98
10f6d31
8f0bad0
2a29c7e
d7fa758
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| class DepositoriesController < ApplicationController | ||
| include AccountableResource | ||
|
|
||
| permitted_accountable_attributes :subtype | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| class BalanceSheet::SubtypeGroup | ||
| include Monetizable | ||
|
|
||
| monetize :total, as: :total_money | ||
|
|
||
| attr_reader :subtype, :accounts, :account_group | ||
|
|
||
| def initialize(subtype:, accounts:, account_group:) | ||
| @subtype = subtype | ||
| @accounts = accounts | ||
| @account_group = account_group | ||
| end | ||
|
|
||
| def name | ||
| account_group.accountable_type.short_subtype_label_for(subtype) || account_group.name | ||
| end | ||
|
|
||
| def key | ||
| subtype.presence || "other" | ||
| end | ||
|
|
||
| def total | ||
| accounts.sum(&:converted_balance) | ||
| end | ||
|
|
||
| def currency | ||
| account_group.currency | ||
| end | ||
| end |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,9 @@ | ||
| <%# locals: (account:, url:) %> | ||
|
|
||
| <%= render "accounts/form", account: account, url: url do |form| %> | ||
| <%= form.select :subtype, | ||
| Depository::SUBTYPES.map { |k, v| [v[:long], k] }, | ||
| { label: true, prompt: t("depositories.form.subtype_prompt"), include_blank: t("depositories.form.none") } %> | ||
| <%= form.fields_for :accountable do |accountable_fields| %> | ||
| <%= accountable_fields.select :subtype, | ||
| Depository::SUBTYPES.map { |k, v| [v[:long], k] }, | ||
| { label: true, prompt: t("depositories.form.subtype_prompt"), include_blank: t("depositories.form.none") } %> | ||
| <% end %> | ||
| <% end %> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| class AddCashSubgroupEnabledToFamilies < ActiveRecord::Migration[7.2] | ||
| def change | ||
| add_column :families, :cash_subgroup_enabled, :boolean, null: false, default: true | ||
| end | ||
| end |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,7 +42,7 @@ class ChatsTest < ApplicationSystemTestCase | |
|
|
||
| # After page refresh, we're still on the last chat we were viewing | ||
| within "#chat-container" do | ||
| assert_selector "h1", text: @user.chats.first.title | ||
| assert_selector "h1", text: @user.chats.first.title, visible: :all | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated change: chat test modification in cash subgroup PR. This change to the chat test visibility assertion appears unrelated to the PR's stated objectives of adding cash subgroup functionality. Consider moving unrelated test fixes to a separate commit or PR to maintain clear change history. 🤖 Prompt for AI Agents |
||
| end | ||
| end | ||
| end | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoded "Cash" string should use i18n.
Per coding guidelines, all user-facing strings must use localization via the
t()helper.🤖 Prompt for AI Agents