diff --git a/app/assets/stylesheets/specific/artists.scss b/app/assets/stylesheets/specific/artists.scss index 0690df638..00f74ce55 100644 --- a/app/assets/stylesheets/specific/artists.scss +++ b/app/assets/stylesheets/specific/artists.scss @@ -9,6 +9,10 @@ div#c-artists, div#excerpt { div#a-banned { } + ul ul { + margin-left: 1em; + } + div#a-show { p.legend { margin-bottom: 2em; diff --git a/app/models/artist.rb b/app/models/artist.rb index f6cbcd120..228b54946 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -88,6 +88,23 @@ class Artist < ActiveRecord::Base def url_string_changed? url_string.scan(/\S+/) != url_array 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 module NameMethods @@ -506,6 +523,10 @@ class Artist < ActiveRecord::Base super + [:other_names_index] end + def method_attributes + super + [:domains] + end + def legacy_api_hash return { :id => id, diff --git a/app/views/artists/show.html.erb b/app/views/artists/show.html.erb index 518c81256..edf615e9c 100644 --- a/app/views/artists/show.html.erb +++ b/app/views/artists/show.html.erb @@ -28,13 +28,26 @@ <% if @artist.members.any? %>
  • Members <%= link_to_artists(@artist.members.map(&:name)) %>
  • <% end %> - <% @artist.urls.each do |url| %> -
  • - 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 => "-#{@artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => @artist.name)) %>) + <% if @artist.domains.any? %> +
  • Domains
  • + + <% end %> + <% if @artist.urls.any? %> +
  • URLs
  • + <% end %> <% end %>