aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Sak <joe@joesak.com>2011-06-21 23:09:18 -0500
committerJoe Sak <joe@joesak.com>2011-06-21 23:09:18 -0500
commit39a5167c20e82f41b32de1814227a4fec42428d6 (patch)
tree36dadbc0c92c214b2732d7501ea8f3e752dd7c40
parent074f8cf67b96e69528c46de1449dc5f4a6ef473a (diff)
downloadrefinerycms-blog-39a5167c20e82f41b32de1814227a4fec42428d6.tar.gz
refinerycms-blog-39a5167c20e82f41b32de1814227a4fec42428d6.tar.bz2
refinerycms-blog-39a5167c20e82f41b32de1814227a4fec42428d6.zip
tag url strategy updated
-rw-r--r--app/controllers/blog/posts_controller.rb5
-rw-r--r--app/views/blog/shared/_post.html.erb2
-rw-r--r--app/views/blog/shared/_tags.html.erb2
-rw-r--r--config/routes.rb2
-rw-r--r--features/support/step_definitions/tags_steps.rb2
5 files changed, 7 insertions, 6 deletions
diff --git a/app/controllers/blog/posts_controller.rb b/app/controllers/blog/posts_controller.rb
index 6b59867..4ea2e73 100644
--- a/app/controllers/blog/posts_controller.rb
+++ b/app/controllers/blog/posts_controller.rb
@@ -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)
})
diff --git a/app/views/blog/shared/_post.html.erb b/app/views/blog/shared/_post.html.erb
index e3ce714..00e5d23 100644
--- a/app/views/blog/shared/_post.html.erb
+++ b/app/views/blog/shared/_post.html.erb
@@ -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>
diff --git a/app/views/blog/shared/_tags.html.erb b/app/views/blog/shared/_tags.html.erb
index 140e60e..b0b11ee 100644
--- a/app/views/blog/shared/_tags.html.erb
+++ b/app/views/blog/shared/_tags.html.erb
@@ -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 %> \ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index 4deeb4e..5eb899a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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
diff --git a/features/support/step_definitions/tags_steps.rb b/features/support/step_definitions/tags_steps.rb
index 5d4dced..a99b5d6 100644
--- a/features/support/step_definitions/tags_steps.rb
+++ b/features/support/step_definitions/tags_steps.rb
@@ -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|