Extract method to get budget status text
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user