about summary refs log tree commit diff stats
path: root/app/controllers
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-13 13:13:28 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-13 13:13:28 -0400
commitd365294db7edd79f01b51ac30413707a556f84bb (patch)
tree817396db46ac064962362970bea8e005a9cf2660 /app/controllers
parentdd9b9ac1c2f032e02757e7e4fa4aa588234933d4 (diff)
downloadthoughts-d365294db7edd79f01b51ac30413707a556f84bb.tar.gz
thoughts-d365294db7edd79f01b51ac30413707a556f84bb.tar.bz2
thoughts-d365294db7edd79f01b51ac30413707a556f84bb.zip
Added pending comment page to admin panel
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/admin/comments_controller.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/app/controllers/admin/comments_controller.rb b/app/controllers/admin/comments_controller.rb index bd255ad..ccde3e6 100644 --- a/app/controllers/admin/comments_controller.rb +++ b/app/controllers/admin/comments_controller.rb
@@ -2,7 +2,29 @@ class Admin::CommentsController < Admin::AdminController
2 before_action :set_section 2 before_action :set_section
3 3
4 def index 4 def index
5 @comments = Comment.order(updated_at: :desc).paginate(page: params[:page], per_page: 20) 5 @comments = Comment.where(status: :published).order(updated_at: :desc).paginate(page: params[:page], per_page: 20)
6 end
7
8 def pending
9 @comments = Comment.where(status: :pending).order(updated_at: :desc).paginate(page: params[:page], per_page: 20)
10 end
11
12 def accept
13 @comment = Comment.find(params[:id])
14 @comment.status = :published
15 @comment.save!
16
17 flash.notice = "Comment successfully published."
18 redirect_to pending_admin_comments_url
19 end
20
21 def reject
22 @comment = Comment.find(params[:id])
23 @comment.status = :rejected
24 @comment.save!
25
26 flash.notice = "Comment successfully rejected."
27 redirect_to pending_admin_comments_url
6 end 28 end
7 29
8 def destroy 30 def destroy