From 45d907219a1ebc16461a3fa45d636be575907fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?= Date: Mon, 26 Jun 2017 11:10:34 +0200 Subject: [PATCH] Fix unused translations warning. --- app/helpers/investments_helper.rb | 17 +++++++++++++---- .../budgets/investments/_image_form.html.erb | 2 +- .../investments/_investment_show.html.erb | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/helpers/investments_helper.rb b/app/helpers/investments_helper.rb index f8fd84bf4..513ceb189 100644 --- a/app/helpers/investments_helper.rb +++ b/app/helpers/investments_helper.rb @@ -8,12 +8,21 @@ module InvestmentsHelper investment.image.url.split('/').last.split("?")[0] if investment.image.present? end - def investment_image_advice_note_key(investment) - investment.image.exists? ? "edit_note" : "add_note" + def investment_image_advice_note(investment) + 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 - def investment_image_button_text_key(investment) - investment.image.exists? ? "edit_image" : "add_image" + def investment_image_button_text(investment) + if investment.image.exists? + t "budgets.investments.show.edit_image" + else + t "budgets.investments.show.add_image" + end end def errors_on_image(investment) diff --git a/app/views/budgets/investments/_image_form.html.erb b/app/views/budgets/investments/_image_form.html.erb index 1b321de15..6cccbf9d8 100644 --- a/app/views/budgets/investments/_image_form.html.erb +++ b/app/views/budgets/investments/_image_form.html.erb @@ -4,7 +4,7 @@
- <%= t("budgets.investments.edit_image.#{investment_image_advice_note_key(@investment)}", title: @investment.title) %>

+

<%= investment_image_advice_note(@investment) %>

diff --git a/app/views/budgets/investments/_investment_show.html.erb b/app/views/budgets/investments/_investment_show.html.erb index 5166bed36..4ce59188c 100644 --- a/app/views/budgets/investments/_investment_show.html.erb +++ b/app/views/budgets/investments/_investment_show.html.erb @@ -11,7 +11,7 @@ <% end %> <% 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), class: 'button hollow float-right' %> <% end %>