70 lines
2.2 KiB
Plaintext
70 lines
2.2 KiB
Plaintext
<div class="votes">
|
|
<% if user_signed_in? %>
|
|
<%= t('comments.comment.votes', count: comment.total_votes) %>
|
|
|
|
|
|
|
<span class="in_favor">
|
|
<% if can?(:vote, comment) %>
|
|
<%= link_to vote_comment_path(comment, value: 'yes'),
|
|
method: "post", remote: true do %>
|
|
<span class="icon-angle-up">
|
|
<span class="sr-only"><%= t('votes.agree') %></span>
|
|
</span>
|
|
<% end %>
|
|
<% else %>
|
|
<span class="icon-angle-up"></span>
|
|
<% end %>
|
|
<%= comment.total_likes %>
|
|
</span>
|
|
|
|
<span class="against">
|
|
<% if can?(:vote, comment) %>
|
|
<%= link_to vote_comment_path(comment, value: 'no'),
|
|
method: "post", remote: true do %>
|
|
<span class="icon-angle-down">
|
|
<span class="sr-only"><%= t('votes.disagree') %></span>
|
|
</span>
|
|
<% end %>
|
|
<% else %>
|
|
<span class="icon-angle-down"></span>
|
|
<% end %>
|
|
<%= comment.total_dislikes %>
|
|
</span>
|
|
|
|
<% elsif !user_signed_in? %>
|
|
|
|
<div class="participation-allowed">
|
|
<%= t('comments.comment.votes', count: comment.total_votes) %>
|
|
|
|
|
|
|
<span class="in_favor">
|
|
<% if can?(:vote, comment) %>
|
|
<%= link_to vote_comment_path(comment, value: 'yes'),
|
|
method: "post", remote: true do %>
|
|
<span class="icon-angle-up"></span>
|
|
<% end %>
|
|
<% else %>
|
|
<span class="icon-angle-up"></span>
|
|
<% end %>
|
|
<%= comment.total_likes %>
|
|
</span>
|
|
<span class="against">
|
|
<% if can?(:vote, comment) %>
|
|
<%= link_to vote_comment_path(comment, value: 'no'),
|
|
method: "post", remote: true do %>
|
|
<span class="icon-angle-down"></span>
|
|
<% end %>
|
|
<% else %>
|
|
<span class="icon-angle-down"></span>
|
|
<% end %>
|
|
<%= comment.total_dislikes %>
|
|
</span>
|
|
</div>
|
|
<div class="participation-not-allowed" style='display:none' aria-hidden="false">
|
|
<%= t("votes.comment_unauthenticated",
|
|
signin: link_to(t("votes.signin"), new_user_session_path),
|
|
signup: link_to(t("votes.signup"), new_user_registration_path)).html_safe %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|