Class: Admin::PostCommentsController

Inherits:
ApplicationController
  • Object
show all
Includes:
BlogUrlHelpers
Defined in:
app/controllers/admin/post_comments_controller.rb

Instance Method Summary collapse

Methods included from BlogUrlHelpers

#admin_post_comments_path, #admin_post_path, #admin_post_post_comments_path, #admin_posts_path, #edit_admin_post_path, #new_admin_post_path, #post_archive_path, #post_category_archive_path, #post_category_path, #post_path, #posts_path

Instance Method Details

#approveObject



35
36
37
38
39
40
41
42
43
# File 'app/controllers/admin/post_comments_controller.rb', line 35

def approve
	if Spud::Blog.enable_rakismet && @post_comment.spam
		@post_comment.ham!
	end
	@post_comment.spam = false
	@post_comment.approved = true
	@post_comment.save()
	redirect_to request.referer || admin_post_post_comments_path(@post_comment.post)
end

#createObject



31
32
33
# File 'app/controllers/admin/post_comments_controller.rb', line 31

def create

end

#destroyObject



55
56
57
58
59
60
# File 'app/controllers/admin/post_comments_controller.rb', line 55

def destroy
	if !@post_comment.destroy
		flash[:error] = "Whoops! Something odd happened while trying to delete that comment. Thats not fun. please try again."
	end
	respond_with @post_comment, :location => request.referer || admin_post_post_comments_path(@post_comment.post)
end

#editObject



23
24
25
# File 'app/controllers/admin/post_comments_controller.rb', line 23

def edit
	respond_with @post_comment
end

#indexObject



8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/admin/post_comments_controller.rb', line 8

def index
	@page_name = "Comments"
	if params[:post_id]
		@post_comments = SpudPostComment.where(:spud_post_id => params[:post_id])
	else
		@post_comments = SpudPostComment.for_blog(params[:blog_key])
	end
	@post_comments = @post_comments.ordered.includes(:post).paginate(:page => params[:page], :per_page => 15)
	respond_with @post_comments
end

#showObject



19
20
21
# File 'app/controllers/admin/post_comments_controller.rb', line 19

def show
	respond_with @post_comment
end

#spamObject



45
46
47
48
49
50
51
52
53
# File 'app/controllers/admin/post_comments_controller.rb', line 45

def spam
	if Spud::Blog.enable_rakismet && !@post_comment.spam
		@post_comment.spam!
	end
	@post_comment.spam = true
	@post_comment.approved = false
	@post_comment.save()
	redirect_to request.referer || admin_post_post_comments_path(@post_comment.post)
end

#updateObject



27
28
29
# File 'app/controllers/admin/post_comments_controller.rb', line 27

def update

end