Extract method to get budget status text

This commit is contained in:
Javi Martín
2021-04-21 13:30:56 +02:00
parent be10e1afb6
commit 9f671b9617
2 changed files with 7 additions and 5 deletions

View File

@@ -21,11 +21,7 @@
<% budgets.each do |budget| %>
<tr id="<%= dom_id(budget) %>" class="budget">
<td class="<%= "budget-completed" if budget.finished? %>">
<% if budget.finished? %>
<span>
<%= t("admin.budgets.index.table_completed") %>
</span>
<% end %>
<%= status_text(budget) %>
<strong><%= budget.name %></strong>
</td>
<td>

View File

@@ -29,4 +29,10 @@ class Admin::Budgets::IndexComponent < ApplicationComponent
def duration(budget)
Admin::Budgets::DurationComponent.new(budget).duration
end
def status_text(budget)
if budget.finished?
tag.span t("admin.budgets.index.table_completed")
end
end
end