<%= render :partial => "admin/articles/page_nav" %>
<h3 style="border-bottom:1px solid #ccc;padding:5px">
<% if @article -%>
Comments on <%= link_to @article.title, edit_article_path(@article), :style => 'border:none' %> <span class="right"><%= @article.published? ? link_to(image_tag('/images/mephisto/icons/24-zoom-in.png', :style => 'vertical-align: middle'), @site.permalink_for(@article), :style => 'border:none;') : ' ' %></span>
<% else -%>
Comments for all articles
<% end -%>
</h3>
<% if @article -%>
<%= link_to_function "New comment", "$('new-comment-form').toggle()" %>
<div id="new-comment-form" style="display:none"><%= render :partial => "new_comment" %></div>
<% end -%>
<ul class="pagelist commentlist" id="comment-list">
<% if @comments.any? %>
<% @comments.reverse.each do |comment| -%>
<li class="event-comment<%= cycle("", " shade") %>" id="comment-<%= comment.id %>">
<a name="comment-<%= comment.id %>"></a>
<% unless comment.body.blank? -%>
<blockquote><p>"<%= strip_tags(comment.body) %>"</p></blockquote>
<% end -%>
<span class="meta">
<cite>— <%= author_link_for comment %><%= %( (#{comment.author_email})) unless comment.author_email.blank? %> said <%= time_ago_in_words comment.created_at %> ago</cite>
<%= link_to_remote 'Edit', :url => edit_article_comment_path(comment.article, comment), :method => :get %> |
<% if comment.approved? -%>
<%= link_to_remote 'Unapprove', :url => unapprove_article_comment_path(comment.article, comment) %> |
<% else -%>
<%= link_to_remote 'Approve', :url => approve_article_comment_path(comment.article, comment) %> |
<% end -%>
<%= link_to_remote 'Delete', :url => article_comment_path(comment.article, comment), :method => :delete %>
</span>
</li>
<% end -%>
<% else %>
<li class="event-none shade">This article has no <%= params[:filter].to_s.humanize.downcase %> comments.</li>
<% end %>
</ul>
<% content_for :sidebar do %>
<% if @articles.size > 1 -%>
<div class="sgroup">
<h3>Comments awaiting your approval</h3>
<ul class="slist">
<% @articles.each do |article, count| -%>
<% if @article.nil? || article.title != @article.title -%>
<li><%= link_to "<strong>(#{count})</strong> #{h(article.title)}", :controller => 'comments', :action => 'index', :article_id => article.id, :filter => :unapproved %></li>
<% end -%>
<% end -%>
</ul>
</div>
<% end -%>
<% end %>
<script type="text/javascript" language="javascript" charset="utf-8">
// <![CDATA[
var comment = $(document.location.hash.substring(1));
if(comment) Element.addClassName(comment, 'focused');
// ]]>
</script>