This commit is contained in:
Toks
2013-07-09 13:03:51 -04:00
parent 83c6428208
commit 3afcd48925
3 changed files with 36 additions and 10 deletions

View File

@@ -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

View File

@@ -23,6 +23,8 @@
<li><%= link_to "Artist", artist_path(@post_set.artist), :id => "show-excerpt-link" %></li>
<% elsif @post_set.has_wiki? %>
<li><%= link_to "Wiki", wiki_page_path(@post_set.wiki_page), :id => "show-excerpt-link" %></li>
<% elsif @post_set.has_pool? %>
<li><%= link_to "Pool", pool_path(@post_set.pool), :id => "show-excerpt-link" %></li>
<% end %>
</menu>

View File

@@ -3,7 +3,7 @@
-->
<div id="excerpt" style="display: none;">
<% if post_set.artist %>
<% if post_set.has_artist? %>
<% unless post_set.artist.notes.blank? %>
<div class="prose">
<%= format_text(post_set.artist.notes) %>
@@ -39,7 +39,7 @@
<p>Read the <%= link_to "full article", wiki_page_path(post_set.wiki_page.id) %>.</p>
</div>
<% elsif post_set.wiki_page %>
<% elsif post_set.has_wiki? %>
<div class="prose">
<%= format_text(post_set.wiki_page.presenter.excerpt) %>
@@ -51,6 +51,18 @@
<p>Read the <%= link_to "full article", wiki_page_path(post_set.wiki_page.id) %>.</p>
</div>
<% elsif post_set.has_pool? %>
<h4>
<%= post_set.pool.pretty_category %>:
<%= link_to post_set.pool.pretty_name, pool_path(post_set.pool), :class => "pool-category-#{post_set.pool.category}" %>
<% if post_set.pool.is_deleted? %>
<span class="inactive">(deleted)</span>
<% end %>
</h4>
<div id="description" class="prose">
<%= format_text(post_set.pool.description) %>
</div>
<% else %>
<% if post_set.tag_string.present? %>
<p>There is currently no wiki page for the tag "<%= post_set.tag_string %>". You can <%= link_to "create one", new_wiki_page_path(:wiki_page => {:title => post_set.tag_string}) %>.</p>