From f93281fd02547a615cfad8815b31c494f499067f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 21 Sep 2018 21:56:21 +0200 Subject: [PATCH] Extract link text to a helper This way we can use the same code in custom views which won't use the same text. --- app/helpers/legislation_helper.rb | 4 ++++ app/views/legislation/processes/proposals.html.erb | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/helpers/legislation_helper.rb b/app/helpers/legislation_helper.rb index a93c2fa47..d8dc77f87 100644 --- a/app/helpers/legislation_helper.rb +++ b/app/helpers/legislation_helper.rb @@ -6,4 +6,8 @@ module LegislationHelper def format_date_for_calendar_form(date) l(date, format: "%d/%m/%Y") if date end + + def new_legislation_proposal_link_text(process) + t("proposals.index.start_proposal") + end end diff --git a/app/views/legislation/processes/proposals.html.erb b/app/views/legislation/processes/proposals.html.erb index d78f9964c..f2e8b14dd 100644 --- a/app/views/legislation/processes/proposals.html.erb +++ b/app/views/legislation/processes/proposals.html.erb @@ -22,7 +22,10 @@
<% if @process.proposals_phase.open? %> -

<%= link_to t("proposals.index.start_proposal"), new_legislation_process_proposal_path(@process), class: 'button expanded' %>

+

<%= link_to new_legislation_proposal_link_text(@process), + new_legislation_process_proposal_path(@process), + class: 'button expanded', + id: 'create-new-proposal' %>

<% end %> <%= render 'legislation/proposals/categories', taggable: @process %>