artists/summary: link other names to artist searches.

* Link other names to artist searches instead of to the new artist page.
* Remove the asterisk next to other names indicating the name isn't used
  as the primary name of another artist. This is almost always the case.
This commit is contained in:
evazion
2020-02-08 18:35:16 -06:00
parent 4ed716e90d
commit 3ef4d9c7ac
4 changed files with 16 additions and 28 deletions

View File

@@ -1,17 +0,0 @@
module ArtistsHelper
def link_to_artist(name)
artist = Artist.find_by_name(name)
if artist
link_to(artist.name, artist_path(artist))
else
link_to(name, new_artist_path(artist: {name: name})) + " " + content_tag("span", "*", :class => "new-artist", :title => "No artist with this name currently exists.")
end
end
def link_to_artists(names)
names.map do |name|
link_to_artist(name)
end.join(", ").html_safe
end
end

View File

@@ -159,8 +159,6 @@
--error-message-color: #A00;
--new-artist-color: #A00;
--bulk-update-request-approved-color: green;
--bulk-update-request-failed-color: red;
@@ -441,7 +439,6 @@ body[data-current-user-theme="dark"] {
--low-post-count-color: var(--red-1);
--login-link-color: var(--red-1);
--new-artist-color: var(--red-1);
--remove-favorite-button: var(--red-1);
--fetch-source-data-border: 1px solid var(--grey-4);
--quick-search-form-background: var(--grey-1);

View File

@@ -1,9 +1,4 @@
div#c-artists, div#excerpt {
span.new-artist {
font-weight: bold;
color: var(--new-artist-color);
}
.recent-posts h2 {
margin: 1em 0 0.5em;
}

View File

@@ -3,13 +3,26 @@
<li><strong>Status</strong> <%= artist.status %></li>
<% if artist.other_names.present? %>
<li><strong>Other Names</strong> <%= link_to_artists(artist.other_names) %></li>
<li>
<strong>Other Names</strong>
<% artist.other_names.map do |other_name| %>
<%= link_to other_name, artists_path(search: { any_name_matches: other_name }), class: "artist-other-name" %>
<% end %>
</li>
<% end %>
<% if artist.group_name.present? %>
<li><strong>Group</strong> <%= link_to_artist(artist.group_name) %></li>
<li>
<strong>Group</strong>
<%= link_to artist.group_name, artists_path(search: { group_name: artist.group_name }) %>
</li>
<% end %>
<% if artist.members.present? %>
<li><strong>Members</strong> <%= link_to_artists(artist.members.map(&:name)) %></li>
<li>
<strong>Members</strong>
<% artist.members.each do |member_name| %>
<%= link_to member_name, artists_path(search: { name: member_name }) %>
<% end %>
</li>
<% end %>
<% if artist.domains.any? %>
<li><strong>Domains</strong></li>