Skip to content

Commit

Permalink
Dashboard: marking a comment as spam should load the next non spammy …
Browse files Browse the repository at this point in the history
…comment. Issue publify#239.
  • Loading branch information
Frédéric de Villamil committed Sep 9, 2013
1 parent 7756494 commit e0ebb1b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
3 changes: 2 additions & 1 deletion app/controllers/admin/feedback_controller.rb
Expand Up @@ -111,7 +111,8 @@ def change_state

render(:update) do |page|
if params[:context] != 'listing'
page.visual_effect :fade, "feedback_#{feedback.id}"
@comments = Comment.last_published
page.replace_html('commentList', :partial => 'admin/dashboard/comment')
else
if template == "ham"
page.visual_effect :appear, "feedback_#{feedback.id}"
Expand Down
18 changes: 18 additions & 0 deletions app/views/admin/dashboard/_comment.html.erb
@@ -0,0 +1,18 @@
<% if @comments.size == 0 %>
<li class='alert'><%= _("No comments yet") %></li>
<% else %>
<% for comment in @comments -%>
<li id='feedback_<%= comment.id %>'>
<%= avatar_tag(:email => comment.email, :url => comment.url) %>
<h5>
<%= _("By") %> <%= (comment.url.blank?) ? h(comment.author) : link_to(h(comment.author), comment.url).nofollowify %>
<%= display_date_and_time comment.created_at %>
</h5>
<p>
<%= comment.html.strip_html.slice(0..300) %>
</p>
<%= show_feedback_actions(comment, 'dashboard') %>
<hr />
</li>
<% end %>
<% end %>
19 changes: 1 addition & 18 deletions app/views/admin/dashboard/_comments.html.erb
@@ -1,23 +1,6 @@
<h3><%= _("Latest Comments") %></h3>
<div class='well'>
<ul class='unstyled' id="commentList">
<% if @comments.size == 0 %>
<li class='alert'><%= _("No comments yet") %></li>
<% else %>
<% for comment in @comments -%>
<li id='feedback_<%= comment.id %>'>
<%= avatar_tag(:email => comment.email, :url => comment.url) %>
<h5>
<%= _("By") %> <%= (comment.url.blank?) ? h(comment.author) : link_to(h(comment.author), comment.url).nofollowify %>
<%= display_date_and_time comment.created_at %>
</h5>
<p>
<%= comment.html.strip_html.slice(0..300) %>
</p>
<%= show_feedback_actions(comment, 'dashboard') %>
<hr />
</li>
<% end %>
<% end %>
<%= render :partial => "comment" %>
</ul>
</div>

0 comments on commit e0ebb1b

Please sign in to comment.