<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -77,6 +77,11 @@ class BaseController &lt; ApplicationController
     current_user &amp;&amp; current_user.admin? ? true : access_denied
   end
   
+  def admin_or_moderator_required
+    current_user &amp;&amp; (current_user.admin? || current_user.moderator?) ? true : access_denied
+  end
+  
+  
   def find_user
     if @user = User.active.find(params[:user_id] || params[:id])
       @is_current_user = (@user &amp;&amp; @user.eql?(current_user))</diff>
      <filename>app/controllers/base_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 class CommentsController &lt; BaseController
   before_filter :login_required, :except =&gt; [:index]
+  before_filter :admin_or_moderator_required, :only =&gt; [:delete_selected]
 
   if AppConfig.allow_anonymous_commenting
     skip_before_filter :verify_authenticity_token, :only =&gt; [:create]   #because the auth token might be cached anyway
@@ -111,6 +112,19 @@ class CommentsController &lt; BaseController
       }
     end
   end
+  
+  def delete_selected
+    if request.post?
+      if params[:delete]
+        params[:delete].each { |id|
+          comment = Comment.find(id)
+          comment.destroy if comment.can_be_deleted_by(current_user)
+        }
+      end
+      flash[:notice] = :comments_deleted.l                
+      redirect_to admin_comments_path
+    end
+  end  
 
 
   private</diff>
      <filename>app/controllers/comments_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,37 +1,57 @@
 .yui-b.sidebar
   = render :partial =&gt; 'shared/admin_nav'
 
-#yui-main
-  .yui-b.box
-    %h3
-      = AppConfig.community_name
-      = :comments.l
-
-    -if @comments.page_count &gt; 1
-      .pagination= paginating_links @comments, :link_to_current_page =&gt; true
-
-    %table{&quot;cellspacing&quot;=&gt;&quot;0&quot;, &quot;border&quot;=&gt;&quot;0&quot;, &quot;cellpadding&quot;=&gt;&quot;0&quot;, &quot;width&quot;=&gt;&quot;100%&quot;}
-      %tr
-        %th=:author.l
-        %th=:comment.l
-        %th=:on_commentable.l
-        %th &amp;nbsp;
-        
-      - @comments.each do |comment|
-        %tr{:id =&gt; &quot;comment_#{comment.id}&quot;}
-          %td
-            -if comment.user
-              = link_to h(comment.user.login), user_path(comment.user)
-            -else
-              = link_to_unless(comment.author_url.blank?, h(comment.username), h(comment.author_url)){ h(comment.username) }              
-              %br
-              %small=&quot;(#{comment.author_url})&quot;
-          %td
-            = h comment.comment
-          %td
-            =&quot;#{link_to comment.commentable_name, commentable_url(comment)} (#{comment.commentable_type})&quot;
-          %td
-            =link_to_remote(&quot;Delete&quot;.l, {:url =&gt; comment_path(comment.commentable_type, comment.commentable_id, comment), :method =&gt; :delete, 500 =&gt; 'alert(\'Sorry, there was a server error\'); return false',  :success =&gt; visual_effect(:fade, &quot;comment_#{comment.id}&quot;), :confirm =&gt; &quot;Are you sure you want to permanently delete this comment&quot;} )
-
-    -if @comments.page_count &gt; 1
-      .pagination= paginating_links @comments, :link_to_current_page =&gt; true
+
+- form_tag delete_selected_comments_path, :id =&gt; 'comments' do
+  #yui-main
+    .yui-b.box
+      %h3
+        = AppConfig.community_name
+        = :comments.l
+
+      -if @comments.page_count &gt; 1
+        .pagination= paginating_links @comments, :link_to_current_page =&gt; true
+
+      %table{&quot;cellspacing&quot;=&gt;&quot;0&quot;, &quot;border&quot;=&gt;&quot;0&quot;, &quot;cellpadding&quot;=&gt;&quot;0&quot;, &quot;width&quot;=&gt;&quot;100%&quot;, :style =&gt; &quot;table-layout:fixed;&quot;}
+        %thead
+          %tr
+            %th{:width =&gt; '20px'}
+            %th=:author.l          
+            %th{:width =&gt; &quot;250px&quot;}=:body_text.l
+            %th=:on_commentable.l
+
+        %tbody
+          - @comments.each do |comment|
+            %tr{:id =&gt; &quot;comment_#{comment.id}&quot;}
+              %td= check_box_tag &quot;delete[]&quot;, comment.id
+              %td
+                .left=link_to_remote(image_tag('icons/delete.png', :plugin =&gt; 'community_engine'), {:url =&gt; comment_path(comment.commentable_type, comment.commentable_id, comment), :method =&gt; :delete, 500 =&gt; 'alert(\'Sorry, there was a server error\'); return false',  :success =&gt; visual_effect(:fade, &quot;comment_#{comment.id}&quot;), :confirm =&gt; &quot;Are you sure you want to permanently delete this comment&quot;} )                                
+                .left
+                  -if comment.user
+                    = link_to h(comment.user.login), user_path(comment.user)
+                    %br
+                    %small= comment.user.email
+                  -else
+                    = link_to_unless(comment.author_url.blank?, h(comment.username), h(comment.author_url)){ h(comment.username) }              
+                    %br
+                    %small=comment.author_email
+                    %br
+                    %small=&quot;(#{comment.author_url})&quot;
+              %td{:style =&gt; 'overflow:hidden;'}
+                = comment.comment
+              %td
+                =link_to comment.commentable_name, commentable_url(comment)
+        %tfoot
+          %tr
+            %td{ :colspan =&gt; &quot;4&quot; }
+              -if @comments.any?
+                %a{:href=&gt;&quot;#&quot;, :onclick=&gt;&quot;checkboxes.each(function(e){ e.checked = (e.checked == 0 ? 1 : 0) }); return false;&quot;} Toggle all              
+                %p= submit_tag :delete_selected.l              
+
+
+      -if @comments.page_count &gt; 1
+        .pagination= paginating_links @comments, :link_to_current_page =&gt; true
+
+%script{:type =&gt; 'text/javascript'}
+  var form = $('comments');
+  checkboxes = form.getInputs('checkbox');
\ No newline at end of file</diff>
      <filename>app/views/admin/comments.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -1,16 +1,17 @@
 .box
   %h3=:admin.l
 
-  %ul.list.checks
-    %li= link_to :features.l, homepage_features_path
+  %ul.list
+    %li= link_to_unless_current_unless_current :features.l, homepage_features_path
     - if feature_enabled?('categories')
-      %li= link_to :categories.l, categories_path
+      %li= link_to_unless_current :categories.l, categories_path
     - if feature_enabled?('contests')
-      %li= link_to :contests.l, contests_path
-    %li= link_to :metro_areas.l, metro_areas_path
+      %li= link_to_unless_current :contests.l, contests_path
+    %li= link_to_unless_current :metro_areas.l, metro_areas_path
     - if feature_enabled?('skills')
-      %li= link_to :skills.l, new_skill_path 
+      %li= link_to_unless_current :skills.l, new_skill_path 
     - if feature_enabled?('events')
-      %li= link_to :events.l, events_path
-    %li= link_to :statistics.l, statistics_path
-    %li= link_to :ads.l, ads_path 
+      %li= link_to_unless_current :events.l, events_path
+    %li= link_to_unless_current :statistics.l, statistics_path
+    %li= link_to_unless_current :ads.l, ads_path 
+    %li= link_to_unless_current :comments.l, admin_comments_path </diff>
      <filename>app/views/shared/_admin_nav.html.haml</filename>
    </modified>
    <modified>
      <diff>@@ -83,6 +83,8 @@ resources :skills
 resources :events
 resources :favorites, :path_prefix =&gt; '/:favoritable_type/:favoritable_id'
 resources :comments, :path_prefix =&gt; '/:commentable_type/:commentable_id'
+delete_selected_comments 'comments/delete_selected', :controller =&gt; &quot;comments&quot;, :action =&gt; 'delete_selected'
+
 resources :homepage_features
 resources :metro_areas
 resources :ads</diff>
      <filename>config/desert_routes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -111,6 +111,7 @@
 #en: comment_save_error: Your comment couldn't be saved.
 #en: comment_was_successfully_created: Comment was successfully created.
 #en: comments: Comments
+#en: comments_deleted: Comments deleted
 #en: comments_rss: Comments RSS
 #en: community_tagline: CommunityEngine Rocks!
 #en: compose: Compose</diff>
      <filename>lang/base.yml</filename>
    </modified>
    <modified>
      <diff>@@ -239,6 +239,8 @@ en:
   comment_was_successfully_created: Comment was successfully created.
   #en: comments: Comments
   comments: Comments
+  #en: comments_deleted: Comments deleted
+  comments_deleted: Comments deleted
   #en: comments_rss: Comments RSS
   comments_rss: Comments RSS
   #en: community_tagline: CommunityEngine Rocks!</diff>
      <filename>lang/ui/en-US.yml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>060141c61d63143d56e8ab66d9f89ffc4f0a1a28</id>
    </parent>
  </parents>
  <author>
    <name>bborn</name>
    <email>bruno.bornsztein@gmail.com</email>
  </author>
  <url>http://github.com/bborn/communityengine/commit/f210cb9b7573a219998cf8956f8aa7c070eb3f23</url>
  <id>f210cb9b7573a219998cf8956f8aa7c070eb3f23</id>
  <committed-date>2009-05-10T09:30:27-07:00</committed-date>
  <authored-date>2009-05-10T09:30:27-07:00</authored-date>
  <message>better comments admin</message>
  <tree>ef32b2c163a59cd164b355a786a6f0ff0e35b4ea</tree>
  <committer>
    <name>bborn</name>
    <email>bruno.bornsztein@gmail.com</email>
  </committer>
</commit>
