fixes #2993: Artist URL breakdown
This commit is contained in:
@@ -9,6 +9,10 @@ div#c-artists, div#excerpt {
|
|||||||
div#a-banned {
|
div#a-banned {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ul ul {
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
div#a-show {
|
div#a-show {
|
||||||
p.legend {
|
p.legend {
|
||||||
margin-bottom: 2em;
|
margin-bottom: 2em;
|
||||||
|
|||||||
@@ -88,6 +88,23 @@ class Artist < ActiveRecord::Base
|
|||||||
def url_string_changed?
|
def url_string_changed?
|
||||||
url_string.scan(/\S+/) != url_array
|
url_string.scan(/\S+/) != url_array
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def map_domain(x)
|
||||||
|
case x
|
||||||
|
when "pximg.net"
|
||||||
|
"pixiv.net"
|
||||||
|
|
||||||
|
when "deviantart.net"
|
||||||
|
"deviantart.com"
|
||||||
|
|
||||||
|
else
|
||||||
|
x
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def domains
|
||||||
|
Post.raw_tag_match(name).pluck(:source).map {|x| map_domain(Addressable::URI.parse(x).domain)}.inject(Hash.new(0)) {|h, x| h[x] += 1; h}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module NameMethods
|
module NameMethods
|
||||||
@@ -506,6 +523,10 @@ class Artist < ActiveRecord::Base
|
|||||||
super + [:other_names_index]
|
super + [:other_names_index]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def method_attributes
|
||||||
|
super + [:domains]
|
||||||
|
end
|
||||||
|
|
||||||
def legacy_api_hash
|
def legacy_api_hash
|
||||||
return {
|
return {
|
||||||
:id => id,
|
:id => id,
|
||||||
|
|||||||
@@ -28,13 +28,26 @@
|
|||||||
<% if @artist.members.any? %>
|
<% if @artist.members.any? %>
|
||||||
<li><strong>Members</strong> <%= link_to_artists(@artist.members.map(&:name)) %></li>
|
<li><strong>Members</strong> <%= link_to_artists(@artist.members.map(&:name)) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% @artist.urls.each do |url| %>
|
<% if @artist.domains.any? %>
|
||||||
<li>
|
<li><strong>Domains</strong></li>
|
||||||
URL: <%= link_to h(url.to_s), h(url.to_s) %>
|
<ul>
|
||||||
<% if CurrentUser.user.is_moderator? %>
|
<% @artist.domains.each do |url, count| %>
|
||||||
(<%= link_to("mass edit", edit_moderator_tag_path(:antecedent => "-#{@artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => @artist.name)) %>)
|
<li><%= url %>: <%= count %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</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 %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user