Extact method to get the budget status HTML class
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<tbody>
|
||||
<% budgets.each do |budget| %>
|
||||
<tr id="<%= dom_id(budget) %>" class="budget">
|
||||
<td class="<%= "budget-completed" if budget.finished? %>">
|
||||
<td class="<%= status_html_class(budget) %>">
|
||||
<%= status_text(budget) %>
|
||||
<strong><%= budget.name %></strong>
|
||||
</td>
|
||||
|
||||
@@ -30,6 +30,10 @@ class Admin::Budgets::IndexComponent < ApplicationComponent
|
||||
Admin::Budgets::DurationComponent.new(budget).duration
|
||||
end
|
||||
|
||||
def status_html_class(budget)
|
||||
"budget-completed" if budget.finished?
|
||||
end
|
||||
|
||||
def status_text(budget)
|
||||
if budget.finished?
|
||||
tag.span t("admin.budgets.index.table_completed")
|
||||
|
||||
Reference in New Issue
Block a user