adds voting for comments functionality [#25]
This commit is contained in:
@@ -8,6 +8,11 @@
|
||||
<%= comment.user.name %> • <%= time_ago_in_words(comment.created_at) %>
|
||||
</span>
|
||||
<p><%= comment.body %></p>
|
||||
|
||||
<span id="<%= dom_id(comment) %>_votes">
|
||||
<%= render 'comments/votes', comment: comment %>
|
||||
</span>
|
||||
|
||||
<p class="reply"><%= render 'comments/form', parent: comment %></p>
|
||||
</div>
|
||||
|
||||
|
||||
11
app/views/comments/_votes.html.erb
Normal file
11
app/views/comments/_votes.html.erb
Normal file
@@ -0,0 +1,11 @@
|
||||
<span class="in_favor">
|
||||
<%= link_to "up", debate_comment_votes_path(@debate, comment, value: 'yes'),
|
||||
method: "post", remote: true %>
|
||||
<%= comment.get_likes.size %>
|
||||
</span>
|
||||
|
||||
<span class="against">
|
||||
<%= link_to "down", debate_comment_votes_path(@debate, comment, value: 'no'),
|
||||
method: "post", remote: true %>
|
||||
<%= comment.get_dislikes.size %>
|
||||
</span>
|
||||
Reference in New Issue
Block a user