Skip to content

Commit

Permalink
Fix budget edit button
Browse files Browse the repository at this point in the history
  • Loading branch information
zachgoll committed Jan 16, 2025
1 parent e1d3c7a commit 60f1a1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/budget.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def allocated_spending
end

def allocated_percent
return 0 unless budgeted_spending > 0
return 0 unless budgeted_spending && budgeted_spending > 0

(allocated_spending / budgeted_spending.to_f) * 100
end
Expand Down
8 changes: 5 additions & 3 deletions app/views/budgets/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@
<div class="flex items-center justify-between mb-4">
<h2 class="text-lg font-medium">Categories</h2>

<%= link_to budget_budget_categories_path(@budget), class: "btn btn--secondary flex items-center gap-2" do %>
<%= icon "settings-2", color: "gray" %>
<span>Edit</span>
<% if @budget.initialized? %>
<%= link_to budget_budget_categories_path(@budget), class: "btn btn--secondary flex items-center gap-2" do %>
<%= icon "settings-2", color: "gray" %>
<span>Edit</span>
<% end %>
<% end %>
</div>

Expand Down

0 comments on commit 60f1a1e

Please sign in to comment.