show tags for tag subscriptions in post listing

This commit is contained in:
albert
2013-02-18 20:18:21 -05:00
parent a62fadd0ae
commit 02360c53c7
4 changed files with 17 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ class TagSubscriptionsController < ApplicationController
@tag_subscription = TagSubscription.find(params[:id])
check_privilege(@tag_subscription)
@tag_subscription.update_attributes(params[:tag_subscription])
respond_with(@tag_subscription)
respond_with(@tag_subscription, :location => tag_subscriptions_path)
end
def destroy

View File

@@ -20,7 +20,7 @@ module PostSets
def has_wiki?
tag_array.any? && ::WikiPage.titled(tag_string).exists?
end
def wiki_page
if tag_array.any?
::WikiPage.titled(tag_string).first
@@ -75,6 +75,18 @@ module PostSets
[page.to_i, 1].max
end
def is_tag_subscription?
tag_subscription.present?
end
def tag_subscription
@tag_subscription ||= tag_array.select {|x| x =~ /^sub:/}.map {|x| x.sub(/^sub:/, "")}.first
end
def tag_subscription_tags
@tag_subscription_tags ||= TagSubscription.find_tags(tag_subscription)
end
def presenter
@presenter ||= ::PostSetPresenters::Post.new(self)
end

View File

@@ -11,6 +11,8 @@ module PostSetPresenters
def related_tags
if post_set.is_pattern_search?
pattern_tags
elsif post_set.is_tag_subscription?
post_set.tag_subscription_tags
elsif post_set.is_single_tag?
related_tags_for_single
elsif post_set.is_empty_tag?
@@ -48,7 +50,7 @@ module PostSetPresenters
return tag.related_tag_array.map(&:first)
end
end
def tag_list_html(template)
tag_set_presenter.tag_list_html(template)
end

View File

@@ -2,9 +2,7 @@
<div id="a-posts">
<aside id="sidebar">
<%= render "posts/partials/common/search", :path => posts_tag_subscription_path, :tags => @post_set.tag_string %>
<%= render "posts/partials/index/mode_menu" %>
<%= render "posts/partials/index/blacklist" %>
</aside>