public
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/halorgium/mephisto.git
technoweenie (author)
Mon Mar 10 22:55:13 -0700 2008
commit  e36ec5e981e24cf84bbad049d5ac6ecdf0e2c92b
tree    f7bc4221faf930f75832682e5244f2ed0436582f
parent  690efcf9364da291d62e9b83e192907c4e815fa4 parent  a1407eb22655e040d394c2b34b203d190891eda7
mephisto / app / views / admin / comments / index.rhtml
100644 66 lines (56 sloc) 2.703 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
59
60
61
62
63
64
65
66
<%= 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;') : '&nbsp;' %></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>&mdash; <%= 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>