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 = {})
link_to t("users.signup"), new_user_registration_path, options
end
def link_to_verify_account
link_to t("users.verify_account"), verification_path
end
end

View File

@@ -38,7 +38,7 @@
<% else %>
<div class="callout warning margin-top">
<%= 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>
<% end %>
<% else %>

View File

@@ -43,7 +43,6 @@
<% if reason.present? && !ballot.has_investment?(investment) %>
<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,
budget_investments_path(budget_id: investment.budget_id,
heading_id: investment.heading_id)) %>
@@ -53,7 +52,7 @@
<p>
<small>
<%= 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,
change_ballot: change_ballot,
heading_link: heading_link(@assigned_heading, @budget)).html_safe %>

View File

@@ -7,7 +7,7 @@
<% else %>
<div class="callout warning">
<%= 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>
<% end %>
<% end %>

View File

@@ -33,7 +33,7 @@
<small>
<%= t("votes.budget_investments.#{reason}",
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,
signup: link_to_signup,
supported_headings: (current_user && current_user.headings_voted_within_group(investment.group).map(&:name).sort.to_sentence)

View File

@@ -24,7 +24,7 @@
<% else %>
<div class="callout warning margin-top">
<%= 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>
<% end %>
<% else %>

View File

@@ -24,7 +24,7 @@
<% elsif require_verified_resident_for_commentable?(commentable, current_user) %>
<br>
<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>
<% elsif allow_comments %>
<%= render "comments/form", { commentable: commentable,

View File

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

View File

@@ -37,7 +37,7 @@
<div class="callout warning">
<p>
<%= 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>
</div>
<% end %>

View File

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

View File

@@ -55,7 +55,7 @@
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p>
<%= 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>
</div>
<% elsif !user_signed_in? %>

View File

@@ -8,7 +8,7 @@
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
<p>
<%= 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>
</div>
<% elsif !user_signed_in? %>

View File

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

View File

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