Files
danbooru/app/views/comments/partials/show/_comment.html.erb

70 lines
3.1 KiB
Plaintext

<% if CurrentUser.is_moderator? || (params[:search] && params[:search][:is_deleted] =~ /t/) || !comment.is_deleted? %>
<a name="comment-<%= comment.id %>"></a>
<article class="comment"
data-id="<%= comment.id %>"
data-post-id="<%= comment.post_id %>"
data-creator-id="<%= comment.creator_id %>"
data-updater-id="<%= comment.updater_id %>"
data-score="<%= comment.score %>"
data-do-not-bump-post="<%= comment.do_not_bump_post? %>"
data-is-deleted="<%= comment.is_deleted? %>"
data-is-sticky="<%= comment.is_sticky? %>"
data-below-threshold="<%= comment.score < CurrentUser.user.comment_threshold %>"
data-is-voted="<%= comment.voted_by?(CurrentUser.user) %>">
<div class="author">
<h1>
<%= link_to_user comment.creator %>
<% if comment.is_deleted? %>
(deleted)
<% end %>
</h1>
<p>
<%= time_ago_in_words_tagged(comment.created_at) %>
</p>
</div>
<div class="content">
<div class="body prose">
<%= format_text(comment.body) %>
<%= render "application/update_notice", record: comment %>
</div>
<% if CurrentUser.is_member? %>
<menu>
<% if @post || @posts %>
<li><%= link_to "Reply", new_comment_path(id: comment, comment: { post_id: comment.post_id }), class: "reply-link", remote: true %></li>
<% if comment.editable_by?(CurrentUser.user) %>
<% if comment.is_deleted? %>
<li><%= link_to "Undelete", undelete_comment_path(comment.id), :method => :post, :remote => true %></li>
<% else %>
<li><%= link_to "Delete", comment_path(comment.id), :data => {:confirm => "Are you sure you want to delete this comment?"}, :method => :delete, :remote => true %></li>
<% end %>
<li><%= link_to "Edit", edit_comment_path(comment.id), :id => "edit_comment_link_#{comment.id}", :class => "edit_comment_link" %></li>
<% end %>
<li class="comment-vote-up-link">
<%= link_to "Vote up", comment_votes_path(comment_id: comment.id, score: "up"), method: :post, remote: true %>
</li>
<li class="comment-vote-down-link">
<%= link_to "Vote down", comment_votes_path(comment_id: comment.id, score: "down"), method: :post, remote: true %>
</li>
<li class="comment-unvote-link">
<%= link_to "Unvote", comment_votes_path(comment_id: comment.id), method: :delete, remote: true %>
</li>
<% if CurrentUser.is_moderator? %>
<li>|</li>
<li>
<strong>IP</strong>
<span><%= link_to_ip comment.creator_ip_addr %></span>
</li>
<% end %>
<% end %>
</menu>
<% if comment.editable_by?(CurrentUser.user) %>
<%= render "comments/form", comment: comment, hidden: true %>
<% end %>
<% end %>
</div>
<div class="clearfix"></div>
</article>
<% end %>