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
|
end
|
||||||
|
|
||||||
def tagged
|
def tagged
|
||||||
@tag_name = params[:tag_name]
|
@tag = ActsAsTaggableOn::Tag.find(params[:tag_id])
|
||||||
@blog_posts = BlogPost.tagged_with(@tag_name.titleize).paginate({
|
@tag_name = @tag.name
|
||||||
|
@blog_posts = BlogPost.tagged_with(@tag_name).paginate({
|
||||||
:page => params[:page],
|
:page => params[:page],
|
||||||
:per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
|
:per_page => RefinerySetting.find_or_set(:blog_posts_per_page, 10)
|
||||||
})
|
})
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<% if (tags = post.tag_list).any? %>
|
<% if (tags = post.tag_list).any? %>
|
||||||
<aside class='tagged'>
|
<aside class='tagged'>
|
||||||
<%= t('tagged', :scope => 'blog.posts.show') %>
|
<%= 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>
|
</aside>
|
||||||
<% end %>
|
<% end %>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<h2><%= t('.title') %></h2>
|
<h2><%= t('.title') %></h2>
|
||||||
<nav id='tags'>
|
<nav id='tags'>
|
||||||
<% tag_cloud(@tags, %w(tag1 tag2 tag3 tag4)) do |tag, css_class| %>
|
<% 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 %>
|
<% end %>
|
||||||
</nav>
|
</nav>
|
||||||
<% end %>
|
<% end %>
|
|
@ -6,7 +6,7 @@
|
||||||
match 'categories/:id', :to => 'categories#show', :as => 'blog_category'
|
match 'categories/:id', :to => 'categories#show', :as => 'blog_category'
|
||||||
match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments'
|
match ':id/comments', :to => 'posts#comment', :as => 'blog_post_blog_comments'
|
||||||
get 'archive/:year(/:month)', :to => 'posts#archive', :as => 'archive_blog_posts'
|
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
|
end
|
||||||
|
|
||||||
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
scope(:path => 'refinery', :as => 'admin', :module => 'admin') do
|
||||||
|
|
|
@ -3,7 +3,7 @@ Given /^there is a blog post titled "([^"]*)" and tagged "([^"]*)"$/ do |title,
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I visit the tagged posts page for "([^"]*)"$/ do |tag_name|
|
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
|
end
|
||||||
|
|
||||||
Then /^the blog post should have the tags "([^"]*)"$/ do |tag_list|
|
Then /^the blog post should have the tags "([^"]*)"$/ do |tag_list|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue