Closes GH-29. Blog posts act as taggable. rspec & cukes passing
This commit is contained in:
parent
b3f95341c3
commit
3748c1d9ef
11 changed files with 77 additions and 10 deletions
|
@ -2,6 +2,7 @@ class Blog::PostsController < BlogController
|
|||
|
||||
before_filter :find_all_blog_posts, :except => [:archive]
|
||||
before_filter :find_blog_post, :only => [:show, :comment, :update_nav]
|
||||
before_filter :find_tags
|
||||
|
||||
respond_to :html, :js, :rss
|
||||
|
||||
|
@ -64,6 +65,14 @@ class Blog::PostsController < BlogController
|
|||
end
|
||||
respond_with (@blog_posts)
|
||||
end
|
||||
|
||||
def tagged
|
||||
@tag_name = params[:tag_name]
|
||||
@blog_posts = BlogPost.tagged_with(@tag_name.titleize).paginate({
|
||||
:page => params[:page],
|
||||
:per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
|
||||
})
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
@ -83,5 +92,9 @@ protected
|
|||
:per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
|
||||
})
|
||||
end
|
||||
|
||||
def find_tags
|
||||
@tags = BlogPost.tag_counts_on(:tags)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue