adds moderation to comments and debates [#136]
This commit is contained in:
5
app/views/comments/_actions.html.erb
Normal file
5
app/views/comments/_actions.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<span id="moderator-comment-actions">
|
||||
|
|
||||
<%= link_to t("admin.actions.hide").capitalize, hide_moderation_comment_path(comment),
|
||||
method: :put, remote: true, data: { confirm: t('admin.actions.confirm') } %>
|
||||
</span>
|
||||
@@ -1,30 +1,44 @@
|
||||
<div class="row">
|
||||
<div id="comment-<%= comment.id %>" class="comment small-12 column">
|
||||
<div id="<%= dom_id(comment) %>" class="comment small-12 column">
|
||||
|
||||
<%= avatar_image(comment.user, size: 32, class: 'left') %>
|
||||
<% if comment.hidden? %>
|
||||
This comment has been deleted
|
||||
<% else %>
|
||||
|
||||
<div class="comment-body">
|
||||
<span class="comment-info">
|
||||
<span><%= comment.user.name %></span> • <%= time_ago_in_words(comment.created_at) %>
|
||||
</span>
|
||||
<p><%= comment.body %></p>
|
||||
<%= avatar_image(comment.user, size: 32, class: 'left') %>
|
||||
|
||||
<span id="<%= dom_id(comment) %>_votes" class="comment-votes right">
|
||||
<%= render 'comments/votes', comment: comment %>
|
||||
</span>
|
||||
<div class="comment-body">
|
||||
<span class="comment-info">
|
||||
<span><%= comment.user.name %></span> • <%= time_ago_in_words(comment.created_at) %>
|
||||
</span>
|
||||
<p><%= comment.body %></p>
|
||||
|
||||
<p class="reply">
|
||||
<%= t("debates.comment.responses", count: comment.children_count) %>
|
||||
<% if user_signed_in? %>
|
||||
|
|
||||
<%= render 'comments/form', {parent: comment, toggeable: true} %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<span id="<%= dom_id(comment) %>_votes" class="comment-votes right">
|
||||
<%= render 'comments/votes', comment: comment %>
|
||||
</span>
|
||||
|
||||
<div class="comment-children">
|
||||
<%= render comment.children.reorder('id DESC, lft') %>
|
||||
</div>
|
||||
<p class="reply">
|
||||
<%= t("debates.comment.responses", count: comment.children_count) %>
|
||||
|
||||
<% if user_signed_in? %>
|
||||
|
|
||||
<%= link_to(comment_link_text(comment), "",
|
||||
class: "js-add-comment-link", data: {'id': dom_id(comment)}) %>
|
||||
|
||||
<% if moderator? %>
|
||||
<%= render 'comments/actions', comment: comment %>
|
||||
<% end %>
|
||||
|
||||
<%= render 'comments/form', {parent: comment, toggeable: true} %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<% end %>
|
||||
|
||||
<div class="comment-children">
|
||||
<%= render comment.children.with_deleted.reorder('id DESC, lft') %>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,5 +1,3 @@
|
||||
<%= link_to(comment_link_text(parent), "", class: "js-add-comment-link", data: {'id': dom_id(parent)}) if toggeable %>
|
||||
|
||||
<div id="js-comment-form-<%= dom_id(parent) %>" <%= "style='display:none'".html_safe if toggeable %>>
|
||||
<%= form_for [@debate, Comment.new], remote: true do |f| %>
|
||||
<%= f.text_area :body %>
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
var parent_id = '<%= dom_id(@parent) %>';
|
||||
var parent_id = "<%= dom_id(@parent) %>";
|
||||
var comment_html = "<%= j(render @comment) %>"
|
||||
|
||||
<% if @parent.is_a?(Debate) -%>
|
||||
App.Comments.reset_form(parent_id);
|
||||
App.Comments.add_comment(parent_id, comment_html);
|
||||
<% else -%>
|
||||
App.Comments.reset_and_hide_form(parent_id);
|
||||
App.Comments.add_reply(parent_id, comment_html);
|
||||
<% end -%>
|
||||
|
||||
App.Comments.add_response(parent_id, "<%= j(render @comment) %>");
|
||||
|
||||
Reference in New Issue
Block a user