Files
danbooru/app/views/comments/partials/show/_comment.html.erb
2013-06-14 12:32:25 -04:00

36 lines
1.9 KiB
Plaintext

<article class="comment" data-post-id="<%= comment.post_id %>" data-comment-id="<%= comment.id %>" data-score="<%= comment.score %>">
<div class="author">
<h1><%= link_to_user comment.creator %></h1>
<p>
<%= time_ago_in_words_tagged(comment.created_at) %>
</p>
</div>
<div class="content">
<div class="body prose">
<%= format_text(comment.body) %>
<% if comment.updater_id.present? && (comment.updater_id != comment.creator_id || comment.created_at != comment.updated_at) %>
<p class="info">Updated by <%= link_to_user comment.updater %> <%= time_ago_in_words_tagged(comment.updated_at) %></p>
<% end %>
</div>
<% if CurrentUser.is_member? %>
<menu>
<% if @post || @posts %>
<li><%= link_to "Reply", new_comment_path(:post_id => comment.post_id), :class => "reply-link", "data-comment-id" => comment.id %></li>
<% if comment.editable_by?(CurrentUser.user) %>
<li><%= link_to "Delete", comment_path(comment.id), :confirm => "Are you sure you want to delete this comment?", :method => :delete, :remote => true %></li>
<li><%= link_to "Edit", edit_comment_path(comment.id), :id => "edit_comment_link_#{comment.id}", :class => "edit_comment_link" %></li>
<% end %>
<li id="comment-vote-up-link-for-<%= comment.id %>"><%= link_to "Vote up", comment_votes_path(:comment_id => comment.id, :score => "up"), :method => :post, :remote => true %></li>
<li id="comment-vote-down-link-for-<%= comment.id %>"><%= link_to "Vote down", comment_votes_path(:comment_id => comment.id, :score => "down"), :method => :post, :remote => true %></li>
<% end %>
</menu>
<% if comment.editable_by?(CurrentUser.user) %>
<%= render "comments/form", :comment => comment %>
<% end %>
<% end %>
</div>
<div class="clearfix"></div>
</article>