diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1f52f0eea..208ed3d3d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -40,4 +40,11 @@ module ApplicationHelper return false if authorable.blank? || user.blank? authorable.author_id == user.id end + + def back_link_to(destination_path) + destination = destination_path || :back + link_to destination, class: "back" do + "".html_safe + t("shared.back") + end + end end diff --git a/app/views/admin/budgets/edit.html.erb b/app/views/admin/budgets/edit.html.erb index 34672bf7a..94da65a31 100644 --- a/app/views/admin/budgets/edit.html.erb +++ b/app/views/admin/budgets/edit.html.erb @@ -1,7 +1,4 @@ -<%= link_to admin_budgets_path do %> - - <%= t('shared.back') %> -<% end %> +<%= back_link_to admin_budgets_path %>
diff --git a/app/views/admin/budgets/show.html.erb b/app/views/admin/budgets/show.html.erb index 1f3292019..6c133ab9f 100644 --- a/app/views/admin/budgets/show.html.erb +++ b/app/views/admin/budgets/show.html.erb @@ -1,7 +1,4 @@ -<%= link_to admin_budgets_path do %> - - <%= t('shared.back') %> -<% end %> +<%= back_link_to admin_budgets_path %>

<%= @budget.name %>

diff --git a/app/views/budgets/groups/show.html.erb b/app/views/budgets/groups/show.html.erb index 6c2cf8e18..8bfbc21a1 100644 --- a/app/views/budgets/groups/show.html.erb +++ b/app/views/budgets/groups/show.html.erb @@ -1,11 +1,7 @@
- <%= link_to budget_path(@budget), class: "back" do %> - - <%= t('shared.back') %> - <% end %> - + <%= back_link_to budget_path(@budget) %>

<%= t("budgets.groups.show.title") %>

diff --git a/app/views/budgets/investments/_header.html.erb b/app/views/budgets/investments/_header.html.erb index 780370ac3..b58eea03c 100644 --- a/app/views/budgets/investments/_header.html.erb +++ b/app/views/budgets/investments/_header.html.erb @@ -4,10 +4,7 @@
- <%= link_to budget_group_path(@budget, @heading.group), class: "back" do %> - - <%= t("shared.back") %> - <% end %> + <%= back_link_to budget_group_path(@budget, @heading.group) %> <% if can? :show, @ballot %> <%= link_to t("budgets.investments.header.check_ballot"), @@ -52,10 +49,7 @@
- <%= link_to budget_path(@budget), class: "back" do %> - - <%= t("shared.back") %> - <% end %> + <%= back_link_to budget_path(@budget) %>

<%= t('budgets.investments.index.title') %>

diff --git a/app/views/budgets/investments/_investment_show.html.erb b/app/views/budgets/investments/_investment_show.html.erb index b4ba679e5..12f23fe87 100644 --- a/app/views/budgets/investments/_investment_show.html.erb +++ b/app/views/budgets/investments/_investment_show.html.erb @@ -2,10 +2,7 @@
- <%= link_to :back, class: "back" do %> - - <%= t("shared.back") %> - <% end %> + <%= back_link_to budget_investments_path(investment.budget) %>

<%= investment.title %>

@@ -35,7 +32,7 @@

<% end %> - <%= render 'shared/tags', taggable: @investment %> + <%= render 'shared/tags', taggable: investment %> <%= safe_html_with_links investment.description.html_safe %> diff --git a/app/views/budgets/show.html.erb b/app/views/budgets/show.html.erb index c43684363..499b7eb58 100644 --- a/app/views/budgets/show.html.erb +++ b/app/views/budgets/show.html.erb @@ -1,10 +1,7 @@
- <%= link_to budgets_path, class: "back" do %> - - <%= t('shared.back') %> - <% end %> + <%= back_link_to budgets_path %>

<%= @budget.name %>

diff --git a/app/views/valuation/budget_investments/show.html.erb b/app/views/valuation/budget_investments/show.html.erb index f0eaed2c8..c48cd52de 100644 --- a/app/views/valuation/budget_investments/show.html.erb +++ b/app/views/valuation/budget_investments/show.html.erb @@ -1,7 +1,4 @@ -<%= link_to valuation_budget_budget_investments_path do %> - - <%= t('shared.back') %> -<% end %> +<%= back_link_to valuation_budget_budget_investments_path %>

<%= t("valuation.budget_investments.show.title") %> <%= @investment.id %>

<%= @investment.title %>