Files
sure/app/views/transactions/categorizes/_entry_row.html.erb
Mikael Møller 5cb474d61c Quick Categorize Wizard — follow-up fixes (#1393)
* Extract Entry.uncategorized_transactions scope, remove Family#uncategorized_transaction_count

Adds a single Entry.uncategorized_transactions scope containing the
shared conditions (transactions join, active accounts, category nil,
not transfer kinds, not excluded). All callers now use this scope:

- Entry.uncategorized_matching builds on it
- Transaction::Grouper::ByMerchantOrName#uncategorized_entries uses it
- categorizes_controller#uncategorized_entries_for uses it (also fixes
  missing status/excluded filters that were silently absent before)
- Both controllers replace Current.family.uncategorized_transaction_count
  with Current.accessible_entries.uncategorized_transactions.count so
  the button count and wizard count both respect account sharing

Family#uncategorized_transaction_count removed as it is now unused and
was family-scoped rather than user-scoped.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Scope assign_entry write to Current.accessible_entries

Replaces unscoped Entry.where(id:) with Current.accessible_entries.where(id:)
so the write path is consistent with the find above it. Not exploitable
given the find would 404 first, but removes the pattern inconsistency.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add privacy-sensitive class to amounts in categorize wizard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Extract uncategorized_count helper in CategorizesController

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix comment on uncategorized_transactions scope to mention draft accounts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Use uncategorized_count helper in assign_entry action

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-07 13:17:37 +02:00

21 lines
1.4 KiB
Plaintext

<%= turbo_frame_tag "categorize_entry_#{entry.id}" do %>
<input type="hidden" name="all_entry_ids[]" value="<%= entry.id %>">
<div class="grid grid-cols-[1rem_1fr_5rem_6rem_6.5rem] gap-3 items-center px-5 py-3 bg-container hover:bg-container-hover">
<input type="checkbox" name="entry_ids[]" value="<%= entry.id %>"
checked class="checkbox checkbox--light shrink-0"
aria-label="<%= t("transactions.categorizes.entry_row.include_checkbox", name: entry.name) %>"
data-action="change->categorize#uncheckRule">
<span class="min-w-0 font-medium text-primary truncate"><%= entry.name %></span>
<span class="text-secondary whitespace-nowrap"><%= l(entry.date, format: :short) %></span>
<span class="privacy-sensitive font-medium text-right whitespace-nowrap <%= entry.amount.negative? ? "text-green-600" : "text-primary" %>">
<%= format_money(entry.amount_money.abs) %>
</span>
<%= select_tag "category_id",
options_from_collection_for_select(categories, :id, :name),
prompt: t("transactions.categorizes.show.assign_category_prompt"),
aria: { label: t("transactions.categorizes.entry_row.assign_category_select", name: entry.name) },
class: "w-full text-xs border border-primary rounded-lg px-1.5 py-0.5 bg-container text-secondary",
data: { entry_id: entry.id, action: "change->categorize#assignEntry" } %>
</div>
<% end %>