Refactor budget phases step progress functions and usage
This commit is contained in:
@@ -41,7 +41,7 @@ class Budget < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def published_phases
|
||||
phases.published
|
||||
phases.published.order(:id)
|
||||
end
|
||||
|
||||
def description
|
||||
|
||||
@@ -56,7 +56,7 @@ class Budget
|
||||
end
|
||||
|
||||
def step_number
|
||||
budget.published_phases.order(:id).index(self) + 1 || 0
|
||||
budget.published_phases.index(self) + 1 || 0
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
</div>
|
||||
<div class="small-12 medium-3 column info padding" data-equalizer-watch>
|
||||
<p>
|
||||
<% steps_progress = "(#{current_phase.step_number}/#{@budget.published_phases.count})" %>
|
||||
<strong><%= t('budgets.show.phase') %> <%= steps_progress %></strong>
|
||||
<% steps = "(#{@budget.current_phase.step_number}/#{@budget.published_phases.count})" %>
|
||||
<strong><%= t('budgets.show.phase') %> <%= steps %></strong>
|
||||
</p>
|
||||
<h2><%= t("budgets.phase.#{@budget.phase}") %></h2>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user