Extract link text to a helper

This way we can use the same code in custom views which won't use the
same text.
This commit is contained in:
Javi Martín
2018-09-21 21:56:21 +02:00
parent ec18743251
commit f93281fd02
2 changed files with 8 additions and 1 deletions

View File

@@ -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

View File

@@ -22,7 +22,10 @@
<div class="small-12 medium-3 column">
<% if @process.proposals_phase.open? %>
<p><%= link_to t("proposals.index.start_proposal"), new_legislation_process_proposal_path(@process), class: 'button expanded' %></p>
<p><%= link_to new_legislation_proposal_link_text(@process),
new_legislation_process_proposal_path(@process),
class: 'button expanded',
id: 'create-new-proposal' %></p>
<% end %>
<%= render 'legislation/proposals/categories', taggable: @process %>
</div>