diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3cd7580ee..59150b1a0 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -43,10 +43,9 @@ module ApplicationHelper authorable.author_id == user.id end - def back_link_to(destination_path) - destination = destination_path || :back + def back_link_to(destination = :back, text = t("shared.back")) link_to destination, class: "back" do - "".html_safe + t("shared.back") + "".html_safe + text end end diff --git a/app/views/admin/geozones/edit.html.erb b/app/views/admin/geozones/edit.html.erb index b6b8c3fd9..554d82e98 100644 --- a/app/views/admin/geozones/edit.html.erb +++ b/app/views/admin/geozones/edit.html.erb @@ -1,10 +1,6 @@
-
- <%= link_to admin_geozones_path, class: "back" do %> - - <%= t("admin.geozones.edit.back") %> - <% end %> + <%= back_link_to admin_geozones_path, t("admin.geozones.edit.back") %>

<%= t("admin.geozones.edit.editing") %>

diff --git a/app/views/admin/geozones/new.html.erb b/app/views/admin/geozones/new.html.erb index 0d5080337..14e43e34e 100644 --- a/app/views/admin/geozones/new.html.erb +++ b/app/views/admin/geozones/new.html.erb @@ -1,10 +1,6 @@
-
- <%= link_to admin_geozones_path, class: "back" do %> - - <%= t("admin.geozones.new.back") %> - <% end %> + <%= back_link_to admin_geozones_path, t("admin.geozones.new.back") %>

<%= t("admin.geozones.new.creating") %>

diff --git a/app/views/admin/legislation/draft_versions/edit.html.erb b/app/views/admin/legislation/draft_versions/edit.html.erb index c041f02c2..9a1d959f1 100644 --- a/app/views/admin/legislation/draft_versions/edit.html.erb +++ b/app/views/admin/legislation/draft_versions/edit.html.erb @@ -4,10 +4,8 @@
- <%= link_to admin_legislation_process_draft_versions_path(@process), class: "back" do %> - - <%= t("admin.legislation.draft_versions.edit.back") %> - <% end %> + <%= back_link_to admin_legislation_process_draft_versions_path(@process), + t("admin.legislation.draft_versions.edit.back") %>

<%= @process.title %>

diff --git a/app/views/admin/legislation/draft_versions/index.html.erb b/app/views/admin/legislation/draft_versions/index.html.erb index a4d8fea24..26310b19e 100644 --- a/app/views/admin/legislation/draft_versions/index.html.erb +++ b/app/views/admin/legislation/draft_versions/index.html.erb @@ -4,10 +4,7 @@
- <%= link_to admin_legislation_processes_path, class: "back" do %> - - <%= t("admin.legislation.processes.edit.back") %> - <% end %> + <%= back_link_to admin_legislation_processes_path, t("admin.legislation.processes.edit.back") %>

<%= @process.title %>

diff --git a/app/views/admin/legislation/draft_versions/new.html.erb b/app/views/admin/legislation/draft_versions/new.html.erb index 81509531c..63ab6f8e7 100644 --- a/app/views/admin/legislation/draft_versions/new.html.erb +++ b/app/views/admin/legislation/draft_versions/new.html.erb @@ -4,10 +4,8 @@
- <%= link_to admin_legislation_process_draft_versions_path(@process), class: "back" do %> - - <%= t("admin.legislation.draft_versions.new.back") %> - <% end %> + <%= back_link_to admin_legislation_process_draft_versions_path(@process), + t("admin.legislation.draft_versions.new.back") %>

<%= @process.title %>

diff --git a/app/views/admin/legislation/processes/edit.html.erb b/app/views/admin/legislation/processes/edit.html.erb index 38bb01147..5d2c1aa8a 100644 --- a/app/views/admin/legislation/processes/edit.html.erb +++ b/app/views/admin/legislation/processes/edit.html.erb @@ -5,10 +5,7 @@
- <%= link_to admin_legislation_processes_path, class: "back" do %> - - <%= t("admin.legislation.processes.edit.back") %> - <% end %> + <%= back_link_to admin_legislation_processes_path, t("admin.legislation.processes.edit.back") %>

<%= @process.title %>

diff --git a/app/views/admin/legislation/processes/new.html.erb b/app/views/admin/legislation/processes/new.html.erb index 026697faa..8acb724db 100644 --- a/app/views/admin/legislation/processes/new.html.erb +++ b/app/views/admin/legislation/processes/new.html.erb @@ -5,10 +5,7 @@
- <%= link_to admin_legislation_processes_path, class: "back" do %> - - <%= t("admin.legislation.processes.new.back") %> - <% end %> + <%= back_link_to admin_legislation_processes_path, t("admin.legislation.processes.new.back") %>

<%= t("admin.legislation.processes.new.title") %>

diff --git a/app/views/admin/legislation/questions/edit.html.erb b/app/views/admin/legislation/questions/edit.html.erb index b87f7daeb..f2293b6c3 100644 --- a/app/views/admin/legislation/questions/edit.html.erb +++ b/app/views/admin/legislation/questions/edit.html.erb @@ -4,10 +4,7 @@
- <%= link_to admin_legislation_process_questions_path(@process), class: "back" do %> - - <%= t("admin.legislation.questions.edit.back") %> - <% end %> + <%= back_link_to admin_legislation_process_questions_path(@process), t("admin.legislation.questions.edit.back") %>

<%= @process.title %>

diff --git a/app/views/admin/legislation/questions/index.html.erb b/app/views/admin/legislation/questions/index.html.erb index d630fa659..fbbb7c93b 100644 --- a/app/views/admin/legislation/questions/index.html.erb +++ b/app/views/admin/legislation/questions/index.html.erb @@ -4,10 +4,7 @@
- <%= link_to admin_legislation_processes_path, class: "back" do %> - - <%= t("admin.legislation.questions.index.back") %> - <% end %> + <%= back_link_to admin_legislation_processes_path, t("admin.legislation.questions.index.back") %>

<%= @process.title %>

diff --git a/app/views/admin/legislation/questions/new.html.erb b/app/views/admin/legislation/questions/new.html.erb index eb3aa7ec1..877c70eb5 100644 --- a/app/views/admin/legislation/questions/new.html.erb +++ b/app/views/admin/legislation/questions/new.html.erb @@ -4,10 +4,7 @@
- <%= link_to admin_legislation_process_questions_path(@process), class: "back" do %> - - <%= t("admin.legislation.questions.new.back") %> - <% end %> + <%= back_link_to admin_legislation_process_questions_path(@process), t("admin.legislation.questions.new.back") %>

<%= @process.title %>

diff --git a/app/views/comments/show.html.erb b/app/views/comments/show.html.erb index 90e49a7d3..37d379d4f 100644 --- a/app/views/comments/show.html.erb +++ b/app/views/comments/show.html.erb @@ -1,9 +1,7 @@
- <%= link_to commentable_path(@comment), class: "back" do %> - - <%= t("comments.show.return_to_commentable") + @comment.commentable.title %> - <% end %> + <%= back_link_to commentable_path(@comment), + t("comments.show.return_to_commentable") + @comment.commentable.title %>
diff --git a/app/views/direct_messages/show.html.erb b/app/views/direct_messages/show.html.erb index 8d0f62d84..cc98c8a89 100644 --- a/app/views/direct_messages/show.html.erb +++ b/app/views/direct_messages/show.html.erb @@ -1,9 +1,6 @@
- <%= link_to user_path(@direct_message.receiver), class: "back" do %> - - <%= t("shared.back") %> - <% end %> + <%= back_link_to user_path(@direct_message.receiver) %>
diff --git a/app/views/proposal_notifications/show.html.erb b/app/views/proposal_notifications/show.html.erb index 379b361fb..74f360583 100644 --- a/app/views/proposal_notifications/show.html.erb +++ b/app/views/proposal_notifications/show.html.erb @@ -1,9 +1,6 @@
- <%= link_to user_path(current_user), class: "back" do %> - - <%= t("proposal_notifications.show.back") %> - <% end %> + <%= back_link_to user_path(current_user), t("proposal_notifications.show.back") %>

<%= @notification.title %>

<%= @notification.body %>

diff --git a/app/views/verification/letter/new.html.erb b/app/views/verification/letter/new.html.erb index 648de7478..e0f696171 100644 --- a/app/views/verification/letter/new.html.erb +++ b/app/views/verification/letter/new.html.erb @@ -20,10 +20,7 @@
- <%= link_to account_path, class: "back" do %> - - <%= t("verification.back") %> - <% end %> + <%= back_link_to account_path, t("verification.back") %>

<%= t("verification.letter.new.title") %>

diff --git a/app/views/verification/letter/show.html.erb b/app/views/verification/letter/show.html.erb index 372e1a8d1..acc764646 100644 --- a/app/views/verification/letter/show.html.erb +++ b/app/views/verification/letter/show.html.erb @@ -2,10 +2,7 @@ <%track_event(category: "verification", action: "start_letter" )%>
- <%= link_to account_path, class: "back" do %> - - <%= t("verification.back") %> - <% end %> + <%= back_link_to account_path, t("verification.back") %>

<%= t("verification.letter.edit.title") %>

diff --git a/app/views/verification/residence/new.html.erb b/app/views/verification/residence/new.html.erb index 2159d1a01..95497b87b 100644 --- a/app/views/verification/residence/new.html.erb +++ b/app/views/verification/residence/new.html.erb @@ -18,10 +18,7 @@
- <%= link_to account_path, class: "back" do %> - - <%= t("verification.back") %> - <% end %> + <%= back_link_to account_path, t("verification.back") %>

<%= t("verification.residence.new.title") %>

diff --git a/app/views/verification/sms/edit.html.erb b/app/views/verification/sms/edit.html.erb index d1856e88c..c94b5c9d0 100644 --- a/app/views/verification/sms/edit.html.erb +++ b/app/views/verification/sms/edit.html.erb @@ -18,10 +18,7 @@
- <%= link_to account_path, class: "back" do %> - - <%= t("verification.back") %> - <% end %> + <%= back_link_to account_path, t("verification.back") %>

<%= t("verification.sms.edit.title") %>

diff --git a/app/views/verification/sms/new.html.erb b/app/views/verification/sms/new.html.erb index 820ed01fa..19a8a2e3b 100644 --- a/app/views/verification/sms/new.html.erb +++ b/app/views/verification/sms/new.html.erb @@ -18,10 +18,7 @@
- <%= link_to account_path, class: "back" do %> - - <%= t("verification.back") %> - <% end %> + <%= back_link_to account_path, t("verification.back") %>

<%= t("verification.sms.new.title") %>

diff --git a/app/views/verification/verified_user/show.html.erb b/app/views/verification/verified_user/show.html.erb index 69e98eeb6..13dc2924d 100644 --- a/app/views/verification/verified_user/show.html.erb +++ b/app/views/verification/verified_user/show.html.erb @@ -1,10 +1,7 @@