tag url strategy updated
This commit is contained in:
parent
074f8cf67b
commit
39a5167c20
5 changed files with 7 additions and 6 deletions
|
@ -67,8 +67,9 @@ class Blog::PostsController < BlogController
|
|||
end
|
||||
|
||||
def tagged
|
||||
@tag_name = params[:tag_name]
|
||||
@blog_posts = BlogPost.tagged_with(@tag_name.titleize).paginate({
|
||||
@tag = ActsAsTaggableOn::Tag.find(params[:tag_id])
|
||||
@tag_name = @tag.name
|
||||
@blog_posts = BlogPost.tagged_with(@tag_name).paginate({
|
||||
:page => params[:page],
|
||||
:per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
|
||||
})
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<% if (tags = post.tag_list).any? %>
|
||||
<aside class='tagged'>
|
||||
<%= t('tagged', :scope => 'blog.posts.show') %>
|
||||
<%=raw tags.collect { |tag| link_to tag, tagged_posts_path(tag.parameterize) }.to_sentence %>
|
||||
<%=raw tags.collect { |tag| link_to tag, tagged_posts_path(tag.id, tag.name.parameterize) }.to_sentence %>
|
||||
</aside>
|
||||
<% end %>
|
||||
</section>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<h2><%= t('.title') %></h2>
|
||||
<nav id='tags'>
|
||||
<% tag_cloud(@tags, %w(tag1 tag2 tag3 tag4)) do |tag, css_class| %>
|
||||
<%= link_to tag.name, tagged_posts_path(tag.name.parameterize), :class => css_class %>
|
||||
<%= link_to tag.name, tagged_posts_path(tag.id, tag.name.parameterize), :class => css_class %>
|
||||
<% end %>
|
||||
</nav>
|
||||
<% end %>
|
|
@ -6,7 +6,7 @@
|
|||
match 'categories/:id', :to => 'categories#show', :as => 'blog_category'
|
||||
match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments'
|
||||
get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_blog_posts'
|
||||
get 'tagged/:tag_name' => 'posts#tagged', :as => 'tagged_posts'
|
||||
get 'tagged/:tag_id-:tag_name' => 'posts#tagged', :as => 'tagged_posts'
|
||||
end
|
||||
|
||||
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
||||
|
|
|
@ -3,7 +3,7 @@ Given /^there is a blog post titled "([^"]*)" and tagged "([^"]*)"$/ do |title,
|
|||
end
|
||||
|
||||
When /^I visit the tagged posts page for "([^"]*)"$/ do |tag_name|
|
||||
visit tagged_posts_path(tag_name.parameterize)
|
||||
visit tagged_posts_path(tag.id, tag_name.parameterize)
|
||||
end
|
||||
|
||||
Then /^the blog post should have the tags "([^"]*)"$/ do |tag_list|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue