From 3afcd48925b3c2dd291cf6c7c675b1105d8005f6 Mon Sep 17 00:00:00 2001 From: Toks Date: Tue, 9 Jul 2013 13:03:51 -0400 Subject: [PATCH] fixes #1734 --- app/logical/post_sets/post.rb | 28 +++++++++++++------ app/views/posts/index.html.erb | 2 ++ .../posts/partials/index/_excerpt.html.erb | 16 +++++++++-- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/app/logical/post_sets/post.rb b/app/logical/post_sets/post.rb index 1edcf6510..46281a42b 100644 --- a/app/logical/post_sets/post.rb +++ b/app/logical/post_sets/post.rb @@ -30,6 +30,26 @@ module PostSets end end + def has_artist? + tag_array.any? && ::Artist.name_matches(tag_string).exists? + end + + def artist + ::Artist.name_matches(tag_string).first + end + + def pool_name + tag_string.match(/^pool:(\S+)$/).try(:[], 1) + end + + def has_pool? + tag_array.size == 1 && pool_name && pool + end + + def pool + ::Pool.find(::Pool.name_to_id(pool_name)) + end + def has_deleted? CurrentUser.is_gold? && tag_string !~ /status/ && ::Post.tag_match("#{tag_string} status:deleted").exists? end @@ -54,14 +74,6 @@ module PostSets end end - def has_artist? - tag_array.any? && ::Artist.name_matches(tag_string).exists? - end - - def artist - ::Artist.name_matches(tag_string).first - end - def is_single_tag? tag_array.size == 1 end diff --git a/app/views/posts/index.html.erb b/app/views/posts/index.html.erb index 36ffe6c9b..784591434 100644 --- a/app/views/posts/index.html.erb +++ b/app/views/posts/index.html.erb @@ -23,6 +23,8 @@
  • <%= link_to "Artist", artist_path(@post_set.artist), :id => "show-excerpt-link" %>
  • <% elsif @post_set.has_wiki? %>
  • <%= link_to "Wiki", wiki_page_path(@post_set.wiki_page), :id => "show-excerpt-link" %>
  • + <% elsif @post_set.has_pool? %> +
  • <%= link_to "Pool", pool_path(@post_set.pool), :id => "show-excerpt-link" %>
  • <% end %> diff --git a/app/views/posts/partials/index/_excerpt.html.erb b/app/views/posts/partials/index/_excerpt.html.erb index 5d6558f2e..c5053108e 100644 --- a/app/views/posts/partials/index/_excerpt.html.erb +++ b/app/views/posts/partials/index/_excerpt.html.erb @@ -3,7 +3,7 @@ -->