Extract link to verify account to a mehtod

We were using the same text and the same route in many places.
This commit is contained in:
Javi Martín
2019-10-01 22:19:20 +02:00
parent f8bd3d4f39
commit 86a205c8fc
14 changed files with 17 additions and 18 deletions

View File

@@ -12,4 +12,8 @@ module LinksHelper
def link_to_signup(options = {}) def link_to_signup(options = {})
link_to t("users.signup"), new_user_registration_path, options link_to t("users.signup"), new_user_registration_path, options
end end
def link_to_verify_account
link_to t("users.verify_account"), verification_path
end
end end

View File

@@ -38,7 +38,7 @@
<% else %> <% else %>
<div class="callout warning margin-top"> <div class="callout warning margin-top">
<%= t("budgets.investments.index.sidebar.verified_only", <%= t("budgets.investments.index.sidebar.verified_only",
verify: link_to(t("users.verify_account"), verification_path)).html_safe %> verify: link_to_verify_account).html_safe %>
</div> </div>
<% end %> <% end %>
<% else %> <% else %>

View File

@@ -43,7 +43,6 @@
<% if reason.present? && !ballot.has_investment?(investment) %> <% if reason.present? && !ballot.has_investment?(investment) %>
<div class="js-participation-not-allowed participation-not-allowed" style="display:none"> <div class="js-participation-not-allowed participation-not-allowed" style="display:none">
<% verify_account = link_to(t("users.verify_account"), verification_path) %>
<% my_heading = link_to(investment.heading.name, <% my_heading = link_to(investment.heading.name,
budget_investments_path(budget_id: investment.budget_id, budget_investments_path(budget_id: investment.budget_id,
heading_id: investment.heading_id)) %> heading_id: investment.heading_id)) %>
@@ -53,7 +52,7 @@
<p> <p>
<small> <small>
<%= t("budgets.ballots.reasons_for_not_balloting.#{reason}", <%= t("budgets.ballots.reasons_for_not_balloting.#{reason}",
verify_account: verify_account, signin: link_to_signin, verify_account: link_to_verify_account, signin: link_to_signin,
signup: link_to_signup, my_heading: my_heading, signup: link_to_signup, my_heading: my_heading,
change_ballot: change_ballot, change_ballot: change_ballot,
heading_link: heading_link(@assigned_heading, @budget)).html_safe %> heading_link: heading_link(@assigned_heading, @budget)).html_safe %>

View File

@@ -7,7 +7,7 @@
<% else %> <% else %>
<div class="callout warning"> <div class="callout warning">
<%= t("budgets.investments.index.sidebar.verified_only", <%= t("budgets.investments.index.sidebar.verified_only",
verify: link_to(t("users.verify_account"), verification_path)).html_safe %> verify: link_to_verify_account).html_safe %>
</div> </div>
<% end %> <% end %>
<% end %> <% end %>

View File

@@ -33,7 +33,7 @@
<small> <small>
<%= t("votes.budget_investments.#{reason}", <%= t("votes.budget_investments.#{reason}",
count: investment.group.max_votable_headings, count: investment.group.max_votable_headings,
verify_account: link_to(t("users.verify_account"), verification_path), verify_account: link_to_verify_account,
signin: link_to_signin, signin: link_to_signin,
signup: link_to_signup, signup: link_to_signup,
supported_headings: (current_user && current_user.headings_voted_within_group(investment.group).map(&:name).sort.to_sentence) supported_headings: (current_user && current_user.headings_voted_within_group(investment.group).map(&:name).sort.to_sentence)

View File

@@ -24,7 +24,7 @@
<% else %> <% else %>
<div class="callout warning margin-top"> <div class="callout warning margin-top">
<%= t("budgets.investments.index.sidebar.verified_only", <%= t("budgets.investments.index.sidebar.verified_only",
verify: link_to(t("users.verify_account"), verification_path)).html_safe %> verify: link_to_verify_account).html_safe %>
</div> </div>
<% end %> <% end %>
<% else %> <% else %>

View File

@@ -24,7 +24,7 @@
<% elsif require_verified_resident_for_commentable?(commentable, current_user) %> <% elsif require_verified_resident_for_commentable?(commentable, current_user) %>
<br> <br>
<div data-alert class="callout primary"> <div data-alert class="callout primary">
<%= t("comments.verified_only", verify_account: link_to(t("users.verify_account"), verification_path)).html_safe %> <%= t("comments.verified_only", verify_account: link_to_verify_account).html_safe %>
</div> </div>
<% elsif allow_comments %> <% elsif allow_comments %>
<%= render "comments/form", { commentable: commentable, <%= render "comments/form", { commentable: commentable,

View File

@@ -52,8 +52,7 @@
<% elsif user_signed_in? && !debate.votable_by?(current_user) %> <% elsif user_signed_in? && !debate.votable_by?(current_user) %>
<div class="participation-not-allowed" style="display:none" aria-hidden="false"> <div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p> <p>
<%= t("votes.anonymous", <%= t("votes.anonymous", verify_account: link_to_verify_account).html_safe %>
verify_account: link_to(t("users.verify_account"), verification_path)).html_safe %>
</p> </p>
</div> </div>
<% elsif !user_signed_in? %> <% elsif !user_signed_in? %>

View File

@@ -37,7 +37,7 @@
<div class="callout warning"> <div class="callout warning">
<p> <p>
<%= t("users.direct_messages.new.verified_only", <%= t("users.direct_messages.new.verified_only",
verify_account: link_to(t("users.verify_account"), verification_path)).html_safe %> verify_account: link_to_verify_account).html_safe %>
</p> </p>
</div> </div>
<% end %> <% end %>

View File

@@ -22,8 +22,7 @@
<% elsif user_signed_in? && !proposal.votable_by?(current_user) %> <% elsif user_signed_in? && !proposal.votable_by?(current_user) %>
<div class="participation-not-allowed" style="display:none" aria-hidden="false"> <div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p> <p>
<%= t("votes.verified_only", <%= t("votes.verified_only", verify_account: link_to_verify_account).html_safe %>
verify_account: link_to(t("users.verify_account"), verification_path)).html_safe %>
</p> </p>
</div> </div>
<% elsif !user_signed_in? %> <% elsif !user_signed_in? %>

View File

@@ -55,7 +55,7 @@
<div class="participation-not-allowed" style="display:none" aria-hidden="false"> <div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p> <p>
<%= t("legislation.proposals.not_verified", <%= t("legislation.proposals.not_verified",
verify_account: link_to(t("users.verify_account"), verification_path)).html_safe %> verify_account: link_to_verify_account).html_safe %>
</p> </p>
</div> </div>
<% elsif !user_signed_in? %> <% elsif !user_signed_in? %>

View File

@@ -8,7 +8,7 @@
<div class="participation-not-allowed" style="display:none" aria-hidden="false"> <div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p> <p>
<%= t("legislation.questions.participation.verified_only", <%= t("legislation.questions.participation.verified_only",
verify_account: link_to(t("users.verify_account"), verification_path)).html_safe %> verify_account: link_to_verify_account).html_safe %>
</p> </p>
</div> </div>
<% elsif !user_signed_in? %> <% elsif !user_signed_in? %>

View File

@@ -22,8 +22,7 @@
<% elsif user_signed_in? && !proposal.votable_by?(current_user) %> <% elsif user_signed_in? && !proposal.votable_by?(current_user) %>
<div class="participation-not-allowed" style="display:none" aria-hidden="false"> <div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p> <p>
<%= t("votes.verified_only", <%= t("votes.verified_only", verify_account: link_to_verify_account).html_safe %>
verify_account: link_to(t("users.verify_account"), verification_path)).html_safe %>
</p> </p>
</div> </div>
<% elsif !user_signed_in? %> <% elsif !user_signed_in? %>

View File

@@ -29,8 +29,7 @@
<div tabindex="0"> <div tabindex="0">
<div class="participation-not-allowed" style="display:none" aria-hidden="false"> <div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p> <p>
<%= t("votes.verified_only", <%= t("votes.verified_only", verify_account: link_to_verify_account).html_safe %>
verify_account: link_to(t("users.verify_account"), verification_path)).html_safe %>
</p> </p>
</div> </div>
</div> </div>