From eb498cfa0ce3258fc8f2c22db01120846b142283 Mon Sep 17 00:00:00 2001 From: Shibu M <23173570+DataEnginr@users.noreply.github.com> Date: Wed, 26 Aug 2026 11:29:00 +0530 Subject: [PATCH] Feature/category hierarchy and account search (#2845) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add parent/child category hierarchy to all category selects; add search to account select Category selection consistency: - DS::Select (shared component powering the main transaction form, transaction edit, bulk-update, and transfer category pickers) now indents subcategories with a corner-down-right icon, matching the existing transaction-row category dropdown. - Feed DS::Select-based category pickers with Category.alphabetically_by_hierarchy (parent name, then parent-before-children, then own name) so children render directly under their parent. - Added Category::Group.select_options, a shared helper producing parent-then-child ordered options (with an indent marker) for plain HTML option ordering. - TransactionsControllerTest: - search filter checkbox ordering (q[categories][]) - new-transaction DS::Select category ordering (via trigger id + ancestor traversal) - new-transaction account select renders a search box All new/modified test files verified with 'ruby -c' (syntax) and cross-checked fixture names, family scoping, route helpers, and field names against the actual fixtures/routes/views. Ruby/Bundler network access to rubygems.org is unavailable in this sandbox, so the suite itself has not been executed — run 'bin/rails test' before merging. * Align with design-sure conventions: keep domain logic in component, not template Per .cursor/rules/view_conventions.mdc ('keep domain logic out of the views'), the parent/child hierarchy check for DS::Select items belongs in the component class, not inline in the ERB template. DS::Select already has this exact pattern for other per-item derived properties (color_for, icon_for, logo_for) — added child? alongside them and updated the template to call it instead of computing it inline. Added test/components/DS/select_test.rb (ViewComponent::TestCase, no rendering needed) covering child? directly: subcategory objects, root-category objects, non-hierarchical objects (merchants), and the include_blank placeholder item. Also did a broader pass against the design-sure .cursor/rules to confirm the rest of this branch's changes already comply: - Uses Current.family (never current_family) throughout - Uses the icon() helper exclusively, never lucide_icon directly - No new/hardcoded colors; only existing semantic Tailwind tokens already used elsewhere in these same files - No changes to sure-design-system.css / application.css - Extended existing components/partials rather than creating new ones where one already existed (view_conventions.mdc component-vs-partial guidance) - Test additions stay in Minitest + fixtures, avoid system tests, and test query-method output directly (testing.mdc) * Address CodeRabbit review: sort category groups, tighten test assertion, move grouping out of view * Address review: fix arrow leak in rule summaries, filter panel alignment, simplify splits ordering * fix(pages): set breadcrumbs for changelog and feedback pages (#2889) * fix(app): set breadcrumbs for changelog and feedback pages * feat(test): add test to assert breadcrumbs * fix(test): remove changes * feat(app): update breadcrumbs to use semantic nav element * feat(test): add breadcrumb assertions to changelog and feedback pages * fix(app): replace breadcrumb nav element with div containing data-breadcrumbs attribute * fix ci failures * resolved failures * Regenerate schema.rb from migrations * Fix test * Remove schema dump noise --------- Signed-off-by: Shibu M <23173570+DataEnginr@users.noreply.github.com> Signed-off-by: Juan José Mata Co-authored-by: Claude Co-authored-by: Kenrick Tandrian <60643640+KenTandrian@users.noreply.github.com> Co-authored-by: Juan José Mata --- app/components/DS/category_select.html.erb | 2 +- app/components/DS/category_select.rb | 4 ++ app/components/DS/select.html.erb | 6 +- app/components/DS/select.rb | 8 +++ app/controllers/splits_controller.rb | 8 ++- app/controllers/transactions_controller.rb | 2 +- app/controllers/transfers_controller.rb | 2 +- app/helpers/categories_helper.rb | 2 +- app/models/category.rb | 28 ++++++++- app/models/import/category_mapping.rb | 2 +- .../set_transaction_category.rb | 2 +- .../condition_filter/transaction_category.rb | 2 +- app/views/DS/category_select/_option.html.erb | 1 + app/views/splits/_category_select.html.erb | 4 ++ app/views/transactions/_form.html.erb | 2 +- .../transactions/bulk_updates/new.html.erb | 2 +- .../categorizes/_entry_row.html.erb | 2 +- .../filters/_category_filter.html.erb | 6 +- app/views/transactions/show.html.erb | 2 +- app/views/transfers/show.html.erb | 2 +- test/components/DS/select_test.rb | 49 ++++++++++++++++ test/controllers/splits_controller_test.rb | 15 +++++ .../categorizes_controller_test.rb | 17 ++++++ .../transactions_controller_test.rb | 46 +++++++++++++++ test/models/category/group_test.rb | 58 +++++++++++++++++++ test/models/category_test.rb | 11 ++++ test/models/import/category_mapping_test.rb | 25 ++++++++ .../set_transaction_category_test.rb | 29 ++++++++++ .../transaction_category_test.rb | 27 +++++++++ 29 files changed, 348 insertions(+), 18 deletions(-) create mode 100644 test/components/DS/select_test.rb create mode 100644 test/models/category/group_test.rb create mode 100644 test/models/import/category_mapping_test.rb create mode 100644 test/models/rule/action_executor/set_transaction_category_test.rb create mode 100644 test/models/rule/condition_filter/transaction_category_test.rb diff --git a/app/components/DS/category_select.html.erb b/app/components/DS/category_select.html.erb index 41bb5d4ee..206edb6d4 100644 --- a/app/components/DS/category_select.html.erb +++ b/app/components/DS/category_select.html.erb @@ -15,7 +15,7 @@ class: "form-field__label" %>