Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

allow comment spam flagging

  • Loading branch information...
commit 0b1311f8b3ac7de4fa52f98bea43fb81872c00ac 1 parent c630914
@bborn bborn authored
View
4 app/controllers/comments_controller.rb
@@ -125,6 +125,9 @@ def create
def destroy
@comment = Comment.find(params[:id])
if @comment.can_be_deleted_by(current_user) && @comment.destroy
+ if params[:spam] && AppConfig.akismet_key
+ @comment.spam!
+ end
flash.now[:notice] = :the_comment_was_deleted.l
else
flash.now[:error] = :comment_could_not_be_deleted.l
@@ -143,6 +146,7 @@ def delete_selected
if params[:delete]
params[:delete].each { |id|
comment = Comment.find(id)
+ comment.spam! if params[:spam] && AppConfig.akismet_key
comment.destroy if comment.can_be_deleted_by(current_user)
}
end
View
20 app/views/admin/comments.html.haml
@@ -10,12 +10,19 @@
=f.label :commentable_id.l
=f.text_field :commentable_id
+ =f.label :name.l
+ =f.text_field :author_name_or_user_login_like
+
=f.label :email.l
- =f.text_field :author_email_or_user_email_like
+ =f.text_field :author_email_like
+
+ =f.label :comment_web_site_label.l
+ =f.text_field :author_url_like
+ =f.label :body_text.l
+ =f.text_field :comment_like
%p= f.submit :search.l
-
- form_tag delete_selected_comments_path, :id => 'comments' do
@@ -31,7 +38,7 @@
%table{"cellspacing"=>"0", "border"=>"0", "cellpadding"=>"0", "width"=>"100%", :style => "table-layout:fixed;"}
%thead
%tr
- %th{:width => '30px', :colspan => '2'}
+ %th{:width => '60px', :colspan => '3'}
%th=:author.l
%th{:width => "250px"}=:body_text.l
%th=:on_commentable.l
@@ -39,7 +46,11 @@
%tbody
- @comments.each do |comment|
%tr{:id => "comment_#{comment.id}"}
- %td=link_to_remote(image_tag('icons/delete.png', :plugin => 'community_engine'), {:url => comment_path(comment.commentable_type, comment.commentable_id, comment), :method => :delete, 500 => 'alert(\'Sorry, there was a server error\'); return false', :success => visual_effect(:fade, "comment_#{comment.id}"), :confirm => "Are you sure you want to permanently delete this comment"} )
+ %td
+ =link_to_remote(image_tag('icons/delete.png', :plugin => 'community_engine'), {:url => comment_path(comment.commentable_type, comment.commentable_id, comment), :method => :delete, 500 => 'alert(\'Sorry, there was a server error\'); return false', :success => visual_effect(:fade, "comment_#{comment.id}"), :confirm => "Are you sure you want to permanently delete this comment"} )
+ %td
+ =link_to_remote(image_tag('icons/bad-flag.png', :plugin => 'community_engine'), {:url => comment_path(comment.commentable_type, comment.commentable_id, comment), :method => :delete, 500 => 'alert(\'Sorry, there was a server error\'); return false', :success => visual_effect(:fade, "comment_#{comment.id}"), :confirm => "Are you sure you want to permanently delete this comment and mark it as spam!?"} )
+
%td= check_box_tag "delete[]", comment.id
%td
.left
@@ -63,6 +74,7 @@
-if @comments.any?
%a{:href=>"#", :onclick=>"checkboxes.each(function(e){ e.checked = (e.checked == 0 ? 1 : 0) }); return false;"} Toggle all
%p= submit_tag :delete_selected.l
+ %p= submit_tag :delete_selected_mark_as_spam.l
-if @comments.page_count > 1
View
2  lang/ui/en.yml
@@ -355,6 +355,8 @@ en:
delete: Delete
#en: delete_selected: Delete selected
delete_selected: Delete selected
+ #en: delete_selected_mark_as_spam: Delete selected and mark spam
+ delete_selected_mark_as_spam: Delete selected and mark spam
#en: delete_this_event: Delete this event
delete_this_event: Delete this event
#en: delete_this_forum: Delete this forum
View
BIN  public/images/icons/bad-flag.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Please sign in to comment.
Something went wrong with that request. Please try again.