cache artist domains, show artist domains in wiki excerpt on post listing
This commit is contained in:
@@ -60,6 +60,10 @@ a.blacklisted-active {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#excerpt p.links {
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
#image-container p.desc {
|
#image-container p.desc {
|
||||||
font-size: 80%;
|
font-size: 80%;
|
||||||
color: grey;
|
color: grey;
|
||||||
|
|||||||
@@ -108,13 +108,15 @@ class Artist < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def domains
|
def domains
|
||||||
Post.raw_tag_match(name).pluck(:source).map do |x|
|
Cache.get("artist-domains-#{id}", 1.day) do
|
||||||
begin
|
Post.raw_tag_match(name).pluck(:source).map do |x|
|
||||||
map_domain(Addressable::URI.parse(x).domain)
|
begin
|
||||||
rescue Addressable::URI::InvalidURIError
|
map_domain(Addressable::URI.parse(x).domain)
|
||||||
nil
|
rescue Addressable::URI::InvalidURIError
|
||||||
end
|
nil
|
||||||
end.compact.inject(Hash.new(0)) {|h, x| h[x] += 1; h}
|
end
|
||||||
|
end.compact.inject(Hash.new(0)) {|h, x| h[x] += 1; h}.sort {|a, b| b[1] <=> a[1]}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -4,75 +4,93 @@
|
|||||||
|
|
||||||
<div id="excerpt" style="display: none;">
|
<div id="excerpt" style="display: none;">
|
||||||
<% if post_set.has_artist? %>
|
<% if post_set.has_artist? %>
|
||||||
<% if post_set.artist.visible? %>
|
<% post_set.artist.tap do |artist| %>
|
||||||
<% unless post_set.artist.notes.blank? %>
|
<% if artist.visible? %>
|
||||||
<div class="prose">
|
<% unless artist.notes.blank? %>
|
||||||
<%= format_text(post_set.artist.notes, :ragel => true) %>
|
<div class="prose">
|
||||||
|
<%= format_text(artist.notes, :ragel => true) %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Status</strong> <%= artist.status %></li>
|
||||||
|
<% if artist.has_tag_alias? %>
|
||||||
|
<li><strong>Tag Alias</strong> <%= artist.tag_alias_name %></li>
|
||||||
|
<% end %>
|
||||||
|
<% if artist.other_names.present? %>
|
||||||
|
<li><strong>Other Names</strong> <%= link_to_artists(artist.other_names.split(/ /)) %></li>
|
||||||
|
<% end %>
|
||||||
|
<% if artist.group_name.present? %>
|
||||||
|
<li><strong>Group</strong> <%= link_to_artist(artist.group_name) %></li>
|
||||||
|
<% end %>
|
||||||
|
<% if artist.members.any? %>
|
||||||
|
<li><strong>Members</strong> <%= link_to_artists(artist.members.map(&:name)) %></li>
|
||||||
|
<% end %>
|
||||||
|
<% if artist.domains.any? %>
|
||||||
|
<li><strong>Domains</strong></li>
|
||||||
|
<ul>
|
||||||
|
<% artist.domains.each do |url, count| %>
|
||||||
|
<li><%= url %>: <%= count %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% if artist.urls.any? %>
|
||||||
|
<li><strong>URLs</strong></li>
|
||||||
|
<ul>
|
||||||
|
<% artist.urls.each do |url| %>
|
||||||
|
<li>
|
||||||
|
<%= link_to h(url.to_s), h(url.to_s) %>
|
||||||
|
<% if CurrentUser.user.is_moderator? %>
|
||||||
|
[<%= link_to("mass edit", edit_moderator_tag_path(:antecedent => "-#{artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => artist.name)) %>]
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<%= artist_alias_and_implication_list(artist) %>
|
||||||
|
|
||||||
|
<p class="links">
|
||||||
|
<%= link_to "View wiki", artist.wiki_page %> |
|
||||||
|
<%= link_to "View artist", artist_path(artist.id) %>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p><%= link_to "View wiki page", post_set.artist.wiki_page %></p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div>
|
|
||||||
<ul>
|
|
||||||
<li><strong>Status</strong> <%= post_set.artist.status %></li>
|
|
||||||
<% if post_set.artist.has_tag_alias? %>
|
|
||||||
<li><strong>Tag Alias</strong> <%= post_set.artist.tag_alias_name %></li>
|
|
||||||
<% end %>
|
|
||||||
<% if post_set.artist.other_names.present? %>
|
|
||||||
<li><strong>Other Names</strong> <%= link_to_artists(post_set.artist.other_names.split(/ /)) %></li>
|
|
||||||
<% end %>
|
|
||||||
<% if post_set.artist.group_name.present? %>
|
|
||||||
<li><strong>Group</strong> <%= link_to_artist(post_set.artist.group_name) %></li>
|
|
||||||
<% end %>
|
|
||||||
<% if post_set.artist.members.any? %>
|
|
||||||
<li><strong>Members</strong> <%= link_to_artists(post_set.artist.members.map(&:name)) %></li>
|
|
||||||
<% end %>
|
|
||||||
<% post_set.artist.urls.each do |url| %>
|
|
||||||
<li>
|
|
||||||
URL: <%= link_to h(url.to_s), h(url.to_s) %>
|
|
||||||
<% if CurrentUser.user.is_moderator? %>
|
|
||||||
(<%= link_to("mass edit", edit_moderator_tag_path(:antecedent => "-#{post_set.artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => post_set.artist.name)) %>)
|
|
||||||
<% end %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<%= artist_alias_and_implication_list(post_set.artist) %>
|
|
||||||
|
|
||||||
<p><%= link_to "View artist", artist_path(post_set.artist.id) %></p>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% elsif post_set.has_wiki? %>
|
<% elsif post_set.has_wiki? %>
|
||||||
<div class="prose">
|
<% post_set.wiki_page.tap do |wiki_page| %>
|
||||||
<% if post_set.wiki_page.other_names.present? %>
|
<div class="prose">
|
||||||
<p><%= wiki_page_other_names_list(post_set.wiki_page) %></p>
|
<% if wiki_page.other_names.present? %>
|
||||||
<% end %>
|
<p><%= wiki_page_other_names_list(wiki_page) %></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= format_text(post_set.wiki_page.presenter.excerpt, :ragel => true) %>
|
<%= format_text(wiki_page.presenter.excerpt, :ragel => true) %>
|
||||||
|
|
||||||
<% if post_set.wiki_page.artist %>
|
<%= wiki_page_alias_and_implication_list(wiki_page) %>
|
||||||
<p><%= link_to "View artist", post_set.wiki_page.artist %></p>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= wiki_page_alias_and_implication_list(post_set.wiki_page) %>
|
<p class="links">
|
||||||
|
<%= link_to "View wiki", wiki_page_path(wiki_page.id) %>
|
||||||
<p><%= link_to "View wiki page", wiki_page_path(post_set.wiki_page.id) %></p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
<% elsif post_set.has_pool? %>
|
<% elsif post_set.has_pool? %>
|
||||||
<h4>
|
<% post_set.pool.tap do |pool| %>
|
||||||
<%= post_set.pool.pretty_category %>:
|
<h4>
|
||||||
<%= link_to post_set.pool.pretty_name, pool_path(post_set.pool), :class => "pool-category-#{post_set.pool.category}" %>
|
<%= pool.pretty_category %>:
|
||||||
<% if post_set.pool.is_deleted? %>
|
<%= link_to pool.pretty_name, pool_path(pool), :class => "pool-category-#{pool.category}" %>
|
||||||
<span class="inactive">(deleted)</span>
|
<% if pool.is_deleted? %>
|
||||||
<% end %>
|
<span class="inactive">(deleted)</span>
|
||||||
</h4>
|
<% end %>
|
||||||
|
</h4>
|
||||||
|
|
||||||
<div id="description" class="prose">
|
<div id="description" class="prose">
|
||||||
<%= format_text(post_set.pool.description, :ragel => true) %>
|
<%= format_text(post_set.pool.description, :ragel => true) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p><%= link_to "View pool", pool_path(post_set.pool.id) %></p>
|
<p class="links"><%= link_to "View pool", pool_path(post_set.pool.id) %></p>
|
||||||
|
<% end %>
|
||||||
<% elsif post_set.has_favgroup? %>
|
<% elsif post_set.has_favgroup? %>
|
||||||
<h4>
|
<h4>
|
||||||
Favorite Group:
|
Favorite Group:
|
||||||
|
|||||||
Reference in New Issue
Block a user