_comment.rhtml
2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<li class="article-comment" style='border-bottom:none;'>
<div class="article-comment-inner">
<div class="comment-content comment-logged-in">
<% if Person.find(comment.author_id) %>
<%= link_to image_tag(profile_icon(Person.find(comment.author_id), :minor)),
Person.find(comment.author_id).url,
:class => 'comment-picture',
:title => Person.find(comment.author_id).name
%>
<% end %>
<div class="comment-details">
<div class="comment-text">
<%= link_to(Person.find(comment.author_id).name, Person.find(comment.author_id).url) %><br /><%= txt2html comment.body %>
</div>
<div class="profile-activity-time">
<%= time_ago_as_sentence(comment.created_at) %>
</div>
</div>
<% if logged_in? && (user == profile || user == Person.find(comment.author_id) || user.has_permission?(:moderate_comments, profile)) %>
<% button_bar(:style => 'float: right; margin-top: 0px;') do %>
<%= icon_button(:delete, _('Remove'), { :action => :remove_comment, :comment_id => comment.id }, :method => :get, :confirm => _('Are you sure you want to remove this comment and all its replies?')) %>
<% end %>
<% end %>
<div class="comment_reply post_comment_box closed">
<% if @comment && @comment.errors.any? && @comment.reply_of_id.to_i == comment.id %>
<%= error_messages_for :comment %>
<script type="text/javascript">
jQuery(function() {
document.location.href = '#<%= comment.anchor %>';
add_comment_reply_form('#comment-reply-to-<%= comment.id %>', <%= comment.id %>);
});
</script>
<% end %>
<%= report_abuse(Person.find(comment.author_id), :comment_link, comment) if Person.find(comment.author_id) %>
<%= link_to_function _('Reply'),
"var f = add_comment_reply_form(this, %s); f.find('input[name=comment[title]], textarea').val(''); return false" % comment.id,
:class => 'comment-footer comment-footer-link comment-footer-hide',
:id => 'comment-reply-to-' + comment.id.to_s
%>
</div>
</div>
<% unless Comment.find(comment.id).replies.blank? %>
<ul class="comment-replies">
<% comment.replies.each do |reply| %>
<%= render :partial => 'comment', :locals => { :comment => reply } %>
<% end %>
</ul>
<% end %>
</div>
</li>