Sha256: 666be93eacf1d347f6ca2818899bb3f94c7b6d439bb104c4e7855b53dd5f816f

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

class Spud::Admin::PostCommentsController < Spud::Admin::ApplicationController

	respond_to :html, :xml, :json
	layout 'spud/admin/detail'
	belongs_to_spud_app :blog_posts
	before_filter :find_comment, :only => [:show, :edit, :update, :destroy, :approve, :spam]
	add_breadcrumb 'Blog Posts', :spud_admin_posts_path
	add_breadcrumb 'Comments', :spud_admin_post_comments_path


	def index
		@page_name = "Comments"
		if params[:post_id]
			@post_comments = SpudPost.find(params[:post_id]).comments
		else
			@post_comments = SpudPostComment
		end
		@post_comments = @post_comments.paginate :page => params[:page]
		respond_with @post_comments
	end

	def show
		respond_with @post_comment
	end

	def edit
		respond_with @post_comment
	end

	def update

	end

	def create

	end

	def approve

		if Spud::Blog.enable_rakismet && @post_comment.spam
			@post_comment.ham!
		end
		@post_comment.update_attributes(:spam => false)
		redirect_to request.referer || spud_admin_post_comments_path
	end

	def spam
		if Spud::Blog.enable_rakismet && !@post_comment.spam
			@post_comment.spam!
		end
		@post_comment.update_attributes(:spam => true)
		redirect_to request.referer || spud_admin_post_comments_path
	end

	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 || spud_admin_post_comments_path
	end

	private

	def find_comment
		@post_comment = SpudPostComment.find(params[:id])
	end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
spud_blog-0.9.11 app/controllers/spud/admin/post_comments_controller.rb
tb_blog-1.0.2 app/controllers/spud/admin/post_comments_controller.rb
tb_blog-1.0.1 app/controllers/spud/admin/post_comments_controller.rb
tb_blog-1.0 app/controllers/spud/admin/post_comments_controller.rb
spud_blog-0.9.10 app/controllers/spud/admin/post_comments_controller.rb