sources: factor out 'Fetch source data' box into view component.
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<div class="source-data p-4 mb-4">
|
||||
<%= link_to "Fetch source data", source_path, class: "source-data-fetch" %>
|
||||
<%= 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" %>
|
||||
|
||||
<% if @source.artists.empty? %>
|
||||
(<%= link_to "Create new artist", new_artist_path(artist: { source: @source.canonical_url }), class: "source-data-create-new-artist" %>)
|
||||
<% 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>
|
||||
<% end %>
|
||||
</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>
|
||||
<% end %>
|
||||
</div>
|
||||
Reference in New Issue
Block a user