Sometimes we're interpolating a link inside a translation, and marking the whole translations as HTML safe. However, some translations added by admins to the database or through crowdin are not entirely under our control. Although AFAIK crowdin checks for potential cross-site scripting attacks, it's a good practice to sanitize parts of a string potentially out of our control before marking the string as HTML safe.
64 lines
2.2 KiB
Plaintext
64 lines
2.2 KiB
Plaintext
<% voted_classes = css_classes_for_vote(@debate_votes, debate) %>
|
|
<div class="votes">
|
|
<div class="in-favor inline-block">
|
|
<% if user_signed_in? %>
|
|
<%= link_to vote_debate_path(debate, value: "yes"),
|
|
class: "like #{voted_classes[:in_favor]}", title: t("votes.agree"), method: "post", remote: true do %>
|
|
<span class="icon-like">
|
|
<span class="show-for-sr"><%= t("votes.agree") %></span>
|
|
</span>
|
|
<span class="percentage"><%= votes_percentage("likes", debate) %></span>
|
|
<% end %>
|
|
<% else %>
|
|
<div class="like">
|
|
<span class="icon-like">
|
|
<span class="show-for-sr"><%= t("votes.agree") %></span>
|
|
</span>
|
|
<span class="percentage"><%= votes_percentage("likes", debate) %></span>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<span class="divider"></span>
|
|
|
|
<div class="against inline-block">
|
|
<% if user_signed_in? %>
|
|
<%= link_to vote_debate_path(debate, value: "no"), class: "unlike #{voted_classes[:against]}", title: t("votes.disagree"), method: "post", remote: true do %>
|
|
<span class="icon-unlike">
|
|
<span class="show-for-sr"><%= t("votes.disagree") %></span>
|
|
</span>
|
|
<span class="percentage"><%= votes_percentage("dislikes", debate) %></span>
|
|
<% end %>
|
|
<% else %>
|
|
<div class="unlike">
|
|
<span class="icon-unlike">
|
|
<span class="show-for-sr"><%= t("votes.disagree") %></span>
|
|
</span>
|
|
<span class="percentage"><%= votes_percentage("dislikes", debate) %></span>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<span class="total-votes">
|
|
<%= t("debates.debate.votes", count: debate.votes_score) %>
|
|
</span>
|
|
|
|
<% if user_signed_in? && current_user.organization? %>
|
|
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
|
|
<p>
|
|
<%= t("votes.organizations") %>
|
|
</p>
|
|
</div>
|
|
<% elsif user_signed_in? && !debate.votable_by?(current_user) %>
|
|
<div class="participation-not-allowed" style="display:none" aria-hidden="false">
|
|
<p>
|
|
<%= sanitize(t("votes.anonymous", verify_account: link_to_verify_account)) %>
|
|
</p>
|
|
</div>
|
|
<% elsif !user_signed_in? %>
|
|
<div tabindex="0">
|
|
<%= render "shared/login_to_vote" %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|