Introduces budget.translated_phase
This commit is contained in:
@@ -14,10 +14,11 @@ class Budget < ActiveRecord::Base
|
||||
has_many :groups, dependent: :destroy
|
||||
has_many :headings, through: :groups
|
||||
|
||||
scope :open, -> { where.not(phase: "finished") }
|
||||
scope :current, -> { where.not(phase: "finished") }
|
||||
scope :finished, -> { where(phase: "finished") }
|
||||
scope :valuating, -> { where(valuating: true) }
|
||||
scope :accepting, -> { where(phase: "accepting") }
|
||||
scope :balloting, -> { where(phase: "balloting") }
|
||||
|
||||
def on_hold?
|
||||
phase == "on_hold"
|
||||
@@ -43,6 +44,10 @@ class Budget < ActiveRecord::Base
|
||||
heading_ids.include?(heading.id) ? heading.price : -1
|
||||
end
|
||||
|
||||
def translated_phase
|
||||
I18n.t "budget.phase.#{phase}"
|
||||
end
|
||||
|
||||
def formatted_amount(amount)
|
||||
ActionController::Base.helpers.number_to_currency(amount,
|
||||
precision: 0,
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<%= link_to budget.name, budget %>
|
||||
</td>
|
||||
<td>
|
||||
<%= t("budgets.phases.#{budget.phase}") %>
|
||||
<%= budget.translated_phase %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user