app/controllers/blog/posts_controller.rb in refinerycms-blog-1.0.1 vs app/controllers/blog/posts_controller.rb in refinerycms-blog-1.1
- old
+ new
@@ -1,25 +1,33 @@
class Blog::PostsController < BlogController
before_filter :find_all_blog_posts, :except => [:archive]
before_filter :find_blog_post, :only => [:show, :comment, :update_nav]
+ respond_to :html, :js, :rss
+
def index
- # TODO: respond_to block
+ respond_with (@blog_posts) do |format|
+ format.html
+ format.rss
+ end
end
def show
@blog_comment = BlogComment.new
- # TODO: respond_to block
+ respond_with (@blog_post) do |format|
+ format.html { present(@page) }
+ format.js { render :partial => 'post', :layout => false }
+ end
end
def comment
if (@blog_comment = @blog_post.comments.create(params[:blog_comment])).valid?
if BlogComment::Moderation.enabled? or @blog_comment.ham?
begin
- Blog::CommentMailer.deliver_notification(@blog_comment, request)
+ Blog::CommentMailer.notification(@blog_comment, request).deliver
rescue
logger.warn "There was an error delivering a blog comment notification.\n#{$!}\n"
end
end
@@ -41,10 +49,10 @@
@archive_date = Time.parse(date)
@blog_posts = BlogPost.live.by_archive(@archive_date).paginate({
:page => params[:page],
:per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
})
- # TODO: respond_to block
+ respond_with (@blog_posts)
end
protected
def find_blog_post