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