sources: add artist profile links to fetch source data box.
Add site icons linking to all the artist's sites in the fetch source data box. Some artist entries have a large number of URLs. Various heuristics are applied to try to present the most useful URLs first. Dead URLs and redundant URLs (Pixiv stacc and Twitter intent URLs) are filtered out. Remaining URLs are sorted first by site (to put sites like Pixiv and Twitter first), then by URL (to break ties when an artist has multiple accounts on the same site). Some sites have shitty hard-to-read icons. It can't be helped. The icons are the official favicons of each site.
This commit is contained in:
@@ -3,46 +3,55 @@
|
||||
<%= spinner_icon class: "source-data-loading" %>
|
||||
|
||||
<% if @source.present? %>
|
||||
<dl class="source-data-content">
|
||||
<div class="source-data-artist">
|
||||
<dt>Artist</dt>
|
||||
<dd>
|
||||
<% if @source.artist_name.blank? %>
|
||||
<em>None</em>
|
||||
<% else %>
|
||||
<%= external_link_to @source.profile_url, @source.artist_name, class: "source-data-artist-profile" %>
|
||||
<table class="source-data-content mt-2">
|
||||
<tbody>
|
||||
<% if @source.artist_name.blank? %>
|
||||
<tr>
|
||||
<th>Artist</th>
|
||||
<td><em>None</em></td>
|
||||
</tr>
|
||||
<% elsif @source.artists.empty? %>
|
||||
<tr>
|
||||
<th>Artist</th>
|
||||
<td>
|
||||
<%= external_link_to @source.profile_url, @source.artist_name %>
|
||||
(<%= link_to "Create new artist", new_artist_path(artist: { source: @source.canonical_url }) %>)
|
||||
</td>
|
||||
</tr>
|
||||
<% else %>
|
||||
<% @source.artists.each do |artist| %>
|
||||
<tr>
|
||||
<th>Artist</th>
|
||||
<td>
|
||||
<%= link_to artist.name, artist_path(artist), class: tag_class(artist.tag) %>
|
||||
|
||||
<% if @source.artists.empty? %>
|
||||
(<%= link_to "Create new artist", new_artist_path(artist: { source: @source.canonical_url }), class: "source-data-create-new-artist" %>)
|
||||
<ul class="list-inline">
|
||||
<% profile_urls(artist).each do |artist_url| %>
|
||||
<%= external_link_to artist_url.url, external_site_icon(artist_url.site_name), title: artist_url.url %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<tr class="source-data-tags">
|
||||
<th>Tags</th>
|
||||
<td>
|
||||
<% if @source.tags.empty? %>
|
||||
<em>None</em>
|
||||
<% else %>
|
||||
(<ul class="source-data-translated-artists">
|
||||
<% @source.artists.each do |artist| %>
|
||||
<li><%= link_to artist.name, artist_path(artist), class: tag_class(artist.tag) %></li>
|
||||
<ul class="list-inline">
|
||||
<% @source.tags.each do |tag, href| %>
|
||||
<li>
|
||||
<%= external_link_to href, tag, class: "source-data-tag" %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>)
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</dd>
|
||||
</div>
|
||||
|
||||
<div class="source-data-tags">
|
||||
<dt>Tags</dt>
|
||||
<dd>
|
||||
<% if @source.tags.empty? %>
|
||||
<em>None</em>
|
||||
<% else %>
|
||||
<ul>
|
||||
<% @source.tags.each do |tag, href| %>
|
||||
<li><%= external_link_to href, tag %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<% if @source.image_urls.length > 1 %>
|
||||
<p class="source-data-gallery-warning">Gallery. Tags may not apply to all images.</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</dd>
|
||||
</li>
|
||||
</dl>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -6,15 +6,27 @@ div.source-data {
|
||||
&.loading .source-data-content { display: none; }
|
||||
&.loading .source-data-fetch { display: none; }
|
||||
|
||||
ul {
|
||||
th {
|
||||
padding-right: 1rem;
|
||||
padding-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.icon {
|
||||
height: 1rem;
|
||||
font-size: 1rem;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.source-data-tag {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
dt, dd, li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
dt, .source-data-tags li {
|
||||
margin-right: 1em;
|
||||
background-color: var(--wiki-page-other-name-background-color);
|
||||
padding: 0 0.25rem;
|
||||
margin-right: 0.25rem;
|
||||
margin-bottom: 0.25rem;
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user