_comment.rhtml 2.23 KB
<li class="article-comment" style='border-bottom:none;'>
  <div class="article-comment-inner">

  <div class="comment-content comment-logged-in">

  <%# if comment.author %>
    <%= link_to image_tag(profile_icon(comment.author, :minor)) +
                content_tag('span', comment.author_name, :class => 'comment-info'),
        comment.author.url,
        :class => 'comment-picture',
        :title => comment.author_name
    %>
  <%# end %>

  <div class="comment-details">
    <h4><%= comment.title %></h4>
    <div class="comment-text">
      <p/>
      <%= txt2html comment.body %>
    </div>
    <div class="profile-activity-time">
      <%= show_time(comment.created_at) %>
    </div>
  </div>

  <%# if logged_in? && (user == profile || user == comment.author || user.has_permission?(:moderate_comments, profile)) %>
    <% button_bar(:style => 'float: right; margin-top: 0px;') do %>
      <%= icon_button(:delete, _('Remove this comment and all its replies'), { :profile => params[:profile], :remove_comment => comment.id, :view => params[:view] }, :method => :post, :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(comment.author, :comment_link, comment) if comment.author %>
    <%= 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.replies.blank? %>
  <ul class="comment-replies">
    <% comment.replies.each do |reply| %>
      <%= render :partial => 'comment', :locals => { :comment => reply } %>
    <% end %>
  </ul>
  <% end %>

  </div>
</li>