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]) @tag_subscription = TagSubscription.find(params[:id])
check_privilege(@tag_subscription) check_privilege(@tag_subscription)
@tag_subscription.update_attributes(params[:tag_subscription]) @tag_subscription.update_attributes(params[:tag_subscription])
respond_with(@tag_subscription) respond_with(@tag_subscription, :location => tag_subscriptions_path)
end end
def destroy def destroy

View File

@@ -75,6 +75,18 @@ module PostSets
[page.to_i, 1].max [page.to_i, 1].max
end 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 def presenter
@presenter ||= ::PostSetPresenters::Post.new(self) @presenter ||= ::PostSetPresenters::Post.new(self)
end end

View File

@@ -11,6 +11,8 @@ module PostSetPresenters
def related_tags def related_tags
if post_set.is_pattern_search? if post_set.is_pattern_search?
pattern_tags pattern_tags
elsif post_set.is_tag_subscription?
post_set.tag_subscription_tags
elsif post_set.is_single_tag? elsif post_set.is_single_tag?
related_tags_for_single related_tags_for_single
elsif post_set.is_empty_tag? elsif post_set.is_empty_tag?

View File

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