Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
some alternate text when the dashboard lists are empty
  • Loading branch information
justinfrench committed Sep 26, 2009
1 parent 6d85d37 commit fb0988d
Showing 1 changed file with 42 additions and 34 deletions.
76 changes: 42 additions & 34 deletions app/views/admin/dashboard/show.html.erb
Expand Up @@ -11,45 +11,53 @@

<div id="recent-posts" class="panel">
<h2>Latest Posts</h2>
<ul>
<% @posts.each_with_index do |post, i| -%>
<li class="<%= i == 0 ? 'first ' : '' %>item">
<%= link_to("<h3>%s</h3>" % [h(truncate(post.title, :length => 50))], admin_post_path(post)) %>
<span class='date'><%=h post.published_at.strftime("%b %e") %></span>
<span class='count'><%= link_to(h(post.approved_comments.size), post_path(post)) %></span>
</li>
<% end -%>
</ul>
<% if @posts.any? -%>
<ul>
<% @posts.each_with_index do |post, i| -%>
<li class="<%= i == 0 ? 'first ' : '' %>item">
<%= link_to("<h3>%s</h3>" % [h(truncate(post.title, :length => 50))], admin_post_path(post)) %>
<span class='date'><%=h post.published_at.strftime("%b %e") %></span>
<span class='count'><%= link_to(h(post.approved_comments.size), post_path(post)) %></span>
</li>
<% end -%>
</ul>
<% else -%>
<p>You haven't written anything yet!</p>
<% end -%>
</div>

<div id="recent-comments" class="panel">
<h2>Latest Comments</h2>
<ul>
<% @comment_activity.each_with_index do |activity, i| -%>
<li class="<%= i == 0 ? 'first ' : '' %>item">
<%= link_to("<h3>%s</h3>" % [h(truncate(activity.post.title, :length => 50))], post_path(activity.post)) %>
<span class='date'><%=h activity.most_recent_comment.created_at.strftime("%b %e") %></span>
<span class='count'><%=h activity.post.approved_comments.size %></span>
<ul>
<% activity.comments.each_with_index do |comment, index| -%>
<% content_tag :li, :class => activity.comments.size == index + 1 ? 'last' : nil do -%>
<%= link_to(h(comment.author), admin_comment_path(comment), {:id => "comment-link-#{comment.id}", :class => 'comment-link'}) -%>
<% end -%>
<% end -%>
</ul>
<% activity.comments.each do |comment| -%>
<div class='comment-body' id='comment-body-<%= comment.id %>'>
<div class='comment-actions'>
<%= link_to(image_tag('silk/pencil.png', :alt => 'edit'), admin_comment_path(comment)) %>
<% form_for(:comment, comment, :url => admin_comment_path(comment), :html => {:class => 'delete-item', :id => "delete-comment-#{comment.id}", :method => :delete}) do |form| -%>
<%= image_submit_tag("silk/delete.png") %>
<% if @comment_activity.any? -%>
<ul>
<% @comment_activity.each_with_index do |activity, i| -%>
<li class="<%= i == 0 ? 'first ' : '' %>item">
<%= link_to("<h3>%s</h3>" % [h(truncate(activity.post.title, :length => 50))], post_path(activity.post)) %>
<span class='date'><%=h activity.most_recent_comment.created_at.strftime("%b %e") %></span>
<span class='count'><%=h activity.post.approved_comments.size %></span>
<ul>
<% activity.comments.each_with_index do |comment, index| -%>
<% content_tag :li, :class => activity.comments.size == index + 1 ? 'last' : nil do -%>
<%= link_to(h(comment.author), admin_comment_path(comment), {:id => "comment-link-#{comment.id}", :class => 'comment-link'}) -%>
<% end -%>
<% end -%>
</ul>
<% activity.comments.each do |comment| -%>
<div class='comment-body' id='comment-body-<%= comment.id %>'>
<div class='comment-actions'>
<%= link_to(image_tag('silk/pencil.png', :alt => 'edit'), admin_comment_path(comment)) %>
<% form_for(:comment, comment, :url => admin_comment_path(comment), :html => {:class => 'delete-item', :id => "delete-comment-#{comment.id}", :method => :delete}) do |form| -%>
<%= image_submit_tag("silk/delete.png") %>
<% end -%>
</div>
<%= comment.body_html %>
</div>
<%= comment.body_html %>
</div>
<% end -%>
</li>
<% end -%>
</ul>
<% end -%>
</li>
<% end -%>
</ul>
<% else -%>
<p>You haven't received any comments yet!</p>
<% end -%>
</div>

0 comments on commit fb0988d

Please sign in to comment.