Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

tag url strategy updated

  • Loading branch information...
commit 39a5167c20e82f41b32de1814227a4fec42428d6 1 parent 074f8cf
@joemsak joemsak authored
View
5 app/controllers/blog/posts_controller.rb
@@ -67,8 +67,9 @@ def archive
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)
})
View
2  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>
View
2  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 %>
View
2  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
View
2  features/support/step_definitions/tags_steps.rb
@@ -3,7 +3,7 @@
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|
Please sign in to comment.
Something went wrong with that request. Please try again.