mirror of
https://github.com/we-promise/sure.git
synced 2026-05-29 23:39:03 +00:00
User-facing rename + structural rename. Feature is now called just "Goals" everywhere — page title, sidebar nav, modal headings, flash messages, AI assistant tool. Code identifiers follow: - Models: SavingsGoal → Goal, SavingsContribution → GoalContribution, SavingsGoalAccount → GoalAccount. - Tables: savings_goals → goals, savings_contributions → goal_contributions, savings_goal_accounts → goal_accounts. FK columns savings_goal_id → goal_id. New migration db/migrate/20260511100003_rename_savings_to_goals.rb uses rename_table + rename_column; PG handles index renaming and FK redirection automatically. - Controllers: SavingsGoalsController → GoalsController, SavingsContributionsController → GoalContributionsController. - Routes: /savings_goals → /goals, nested /goals/:id/contributions (resource name shifts; old route name aliases dropped). - ViewComponent namespace: Savings::* → Goals::*. Component class names drop their redundant "Goal" prefix where the namespace already carries it: Savings::GoalCardComponent → Goals::CardComponent, Savings::GoalAvatarComponent → Goals::AvatarComponent. Others keep their names (Goals::ProgressRingComponent, Goals::StatusPillComponent, Goals::AccountStackComponent, Goals::FundingAccountsBreakdownComponent). - Stimulus controllers: savings_goal_* → goal_*, savings_goals_filter → goals_filter. Stimulus identifiers in data-controller / data-* attributes follow. - Locale keys: savings_goals: → goals: (top level), savings_contributions: → goal_contributions: (top level). All t() callers updated. - AI assistant tool: Assistant::Function::CreateSavingsGoal → Assistant::Function::CreateGoal, tool name "create_savings_goal" → "create_goal", description / response text updated. - Sidebar nav label "Savings" → "Goals". Goals/show + index page title "Savings" → "Goals". Empty goals_section heading/subtitle dropped (duplicated the page title post-rename). Original migrations create_savings_goals / create_savings_goal_accounts / create_savings_contributions remain untouched so historical replay still works; the rename migration runs on top.
48 lines
1.8 KiB
Plaintext
48 lines
1.8 KiB
Plaintext
<%# locals: (contributions:) %>
|
|
|
|
<% if contributions.empty? %>
|
|
<div class="px-5 py-8 text-center">
|
|
<p class="text-sm text-secondary"><%= t("goals.show.no_contributions_yet") %></p>
|
|
</div>
|
|
<% else %>
|
|
<ul>
|
|
<% contributions.each do |contribution| %>
|
|
<li class="flex items-center gap-3 px-2 py-2 rounded-lg">
|
|
<%= render Goals::AvatarComponent.new(
|
|
name: contribution.account.name,
|
|
color: Goals::AvatarComponent.color_for(contribution.account.name),
|
|
size: "sm"
|
|
) %>
|
|
<div class="flex-1 min-w-0">
|
|
<p class="text-sm font-medium text-primary truncate"><%= contribution.account.name %></p>
|
|
<p class="text-[11px] text-subdued">
|
|
<%= I18n.l(contribution.contributed_at, format: :long) %> ·
|
|
<%= t("goals.show.source.#{contribution.source}") %>
|
|
</p>
|
|
</div>
|
|
<span class="text-sm font-medium text-success tabular-nums">+<%= contribution.amount_money.format %></span>
|
|
<% if contribution.manual? %>
|
|
<%= render DS::Menu.new do |menu| %>
|
|
<% menu.with_item(
|
|
variant: "button",
|
|
text: t("goals.show.delete_contribution"),
|
|
icon: "trash-2",
|
|
destructive: true,
|
|
href: goal_contribution_path(@goal, contribution),
|
|
method: :delete,
|
|
confirm: CustomConfirm.new(
|
|
destructive: true,
|
|
title: t("goals.show.confirm_delete_contribution_title"),
|
|
body: t("goals.show.confirm_delete_contribution_body", amount: contribution.amount_money.format),
|
|
btn_text: t("goals.show.confirm_delete_contribution_cta")
|
|
)
|
|
) %>
|
|
<% end %>
|
|
<% else %>
|
|
<span class="w-9 h-9"></span>
|
|
<% end %>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
<% end %>
|