Fix unused translations warning.

This commit is contained in:
Senén Rodero Rodríguez
2017-06-26 11:10:34 +02:00
parent cf9a7a21cc
commit 45d907219a
3 changed files with 15 additions and 6 deletions

View File

@@ -8,12 +8,21 @@ module InvestmentsHelper
investment.image.url.split('/').last.split("?")[0] if investment.image.present? investment.image.url.split('/').last.split("?")[0] if investment.image.present?
end end
def investment_image_advice_note_key(investment) def investment_image_advice_note(investment)
investment.image.exists? ? "edit_note" : "add_note" title = investment.title
if investment.image.exists?
t "budgets.investments.edit_image.edit_note", title: title
else
t "budgets.investments.edit_image.add_note", title: title
end
end end
def investment_image_button_text_key(investment) def investment_image_button_text(investment)
investment.image.exists? ? "edit_image" : "add_image" if investment.image.exists?
t "budgets.investments.show.edit_image"
else
t "budgets.investments.show.add_image"
end
end end
def errors_on_image(investment) def errors_on_image(investment)

View File

@@ -4,7 +4,7 @@
<div class="row"> <div class="row">
<div class="small-12 column"> <div class="small-12 column">
<span class="note-marked"> <span class="note-marked">
<%= t("budgets.investments.edit_image.#{investment_image_advice_note_key(@investment)}", title: @investment.title) %></p> <p><%= investment_image_advice_note(@investment) %></p>
</span> </span>
</div> </div>

View File

@@ -11,7 +11,7 @@
<% end %> <% end %>
<% if can?(:edit_image, @investment) %> <% if can?(:edit_image, @investment) %>
<%= link_to t("budgets.investments.show.#{investment_image_button_text_key(@investment)}"), <%= link_to investment_image_button_text(@investment),
edit_image_budget_investment_path(investment.budget, investment), edit_image_budget_investment_path(investment.budget, investment),
class: 'button hollow float-right' %> class: 'button hollow float-right' %>
<% end %> <% end %>