journalduhacker/app/views/comments/_comment.html.erb
2012-08-24 11:41:36 -05:00

68 lines
2 KiB
Plaintext

<li id="comment_<%= comment.short_id %>" data-shortid="<%= comment.short_id %>"
class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ?
"upvoted" : "downvoted") : "" %>
<%= comment.highlighted ? "highlighted" : "" %>
<%= comment.score <= 0 ? "negative" : "" %>
<%= comment.score <= -3 ? "negative_3" : "" %>
<%= comment.score <= -5 ? "negative_5" : "" %>
<%= comment.score <= -7 ? "negative_7" : "" %>">
<div class="voters">
<a class="upvoter"></a>
<div class="score">
<%= comment.score %>
</div>
<a class="downvoter"></a>
</div>
<div class="details">
<div class="byline">
<% if comment.previewing %>
<a><%= comment.user.username %></a>
previewed
just now
<% else %>
<a href="/u/<%= comment.user.username %>"><%= comment.user.username
%></a>
<%= comment.has_been_edited?? "edited" : "" %>
<%= time_ago_in_words(comment.has_been_edited?? comment.updated_at :
comment.created_at).gsub(/^about /, "") %> ago
<span class="reason"><%= comment.current_vote &&
comment.current_vote[:vote] == -1 ?
"(#{Vote::COMMENT_REASONS[comment.current_vote[:reason]].downcase})" :
"" %></span>
<% end %>
<% if !comment.previewing %>
|
<a href="<%= story.comments_url %>/comments/<%= comment.short_id
%>">link</a>
<% if !story.is_gone? %>
|
<% if comment.is_editable_by_user?(@user) %>
<a class="comment_editor">edit</a>
<% else %>
<a class="comment_replier">reply</a>
<% end %>
<% end %>
<% if false && defined?(collapsable) && collapsable # XXX %>
|
<a href="">collapse</a>
<% end %>
<% end %>
<% if defined?(show_story) && show_story %>
| on:
<a href="<%= story.comments_url %>"><%= story.title %></a>
<% end %>
</div>
<div class="comment_text">
<%= raw comment.markeddown_comment %>
</div>
<div class="comment_reply"></div>
</div>
</li>