diff --git a/app/components/goals/card_component.html.erb b/app/components/goals/card_component.html.erb index 768a3ae30..b3a521654 100644 --- a/app/components/goals/card_component.html.erb +++ b/app/components/goals/card_component.html.erb @@ -1,5 +1,5 @@
" - data-goals-filter-target="card" + <% if filterable %>data-goals-filter-target="card"<% end %> data-goal-name="<%= goal.name %>" data-goal-status="<%= goal.display_status %>">
diff --git a/app/components/goals/card_component.rb b/app/components/goals/card_component.rb index 6c0a1e287..6ca6a32a5 100644 --- a/app/components/goals/card_component.rb +++ b/app/components/goals/card_component.rb @@ -2,11 +2,12 @@ class Goals::CardComponent < ApplicationComponent RING_SIZE = 64 RING_STROKE = 6 - def initialize(goal:) + def initialize(goal:, filterable: true) @goal = goal + @filterable = filterable end - attr_reader :goal + attr_reader :goal, :filterable def progress_percent goal.progress_percent diff --git a/app/controllers/goals_controller.rb b/app/controllers/goals_controller.rb index 0605bd3f0..287c3f10a 100644 --- a/app/controllers/goals_controller.rb +++ b/app/controllers/goals_controller.rb @@ -20,9 +20,10 @@ class GoalsController < ApplicationController .sort_by { |g| [ g.paused? ? 3 : ACTIVE_STATUS_RANK.fetch(g.status, 4), g.name.downcase ] } @completed_goals = all_goals.select { |g| g.state == "completed" }.sort_by { |g| g.name.downcase } @archived_goals = all_goals.select { |g| g.state == "archived" } - # Completed goals join the chip-filterable grid below the active ones so - # the `completed` chip can isolate them. Archived stays in the separate - # collapsed-by-default section below. + # Completed goals join the chip-filterable grid below the active ones + # so the `completed` chip can isolate them. Archived stays in a + # separate collapsed-by-default section, opted out of the filter + # entirely (rendered with filterable: false). @grid_goals = @active_goals + @completed_goals @linkable_account_count = Current.family.accounts.where(accountable_type: "Depository").visible.count diff --git a/app/views/goals/index.html.erb b/app/views/goals/index.html.erb index e991ad877..b5b6873d1 100644 --- a/app/views/goals/index.html.erb +++ b/app/views/goals/index.html.erb @@ -182,7 +182,7 @@
<% @archived_goals.each do |goal| %> - <%= render Goals::CardComponent.new(goal: goal) %> + <%= render Goals::CardComponent.new(goal: goal, filterable: false) %> <% end %>