artists: show "Artist" tab in searches for artists without artist entry.
On the post index page, show the "Artist" tab instead of the "Wiki" tab when searching for an artist tag that doesn't have an artist entry. This way the user is prompted to create a new artist entry instead of a new wiki.
This commit is contained in:
@@ -62,6 +62,8 @@
|
||||
|
||||
<% if @post_set.artist.present? %>
|
||||
<%= link_to "Artist", artist_path(@post_set.artist), id: "show-excerpt-link", class: "artist-excerpt-link" %>
|
||||
<% elsif @post_set.tag&.artist? %>
|
||||
<%= link_to "Artist", new_artist_path(artist: { name: @post_set.tag.name }), id: "show-excerpt-link", class: "artist-excerpt-link", rel: "nofollow" %>
|
||||
<% elsif @post_set.wiki_page.present? %>
|
||||
<%= link_to "Wiki", wiki_page_path(@post_set.wiki_page), id: "show-excerpt-link", class: "wiki-excerpt-link" %>
|
||||
<% elsif @post_set.pool.present? %>
|
||||
@@ -158,6 +160,10 @@
|
||||
<p>The artist requested removal of this page.</p>
|
||||
<% elsif @post_set.artist.present? %>
|
||||
<%= render "artists/summary", artist: @post_set.artist %>
|
||||
<% elsif @post_set.tag&.artist? %>
|
||||
<p>There is no artist entry yet for the artist <%= link_to @post_set.tag.name, new_artist_path(artist: { name: @post_set.tag.name }), rel: "nofollow" %>. <%= link_to "Create new artist entry", new_artist_path(artist: { name: @post_set.tag.name }), rel: "nofollow" %>.</p>
|
||||
|
||||
<%= render "tag_relationships/alias_and_implication_list", tag: @post_set.tag %>
|
||||
<% elsif @post_set.wiki_page.present? %>
|
||||
<% @post_set.wiki_page.tap do |wiki_page| %>
|
||||
<div class="prose">
|
||||
@@ -198,7 +204,7 @@
|
||||
</h2>
|
||||
Creator: <%= link_to_user @post_set.favgroup.creator %>
|
||||
<% elsif @post_set.has_blank_wiki? %>
|
||||
<p>There is currently no wiki page for the tag <%= link_to_wiki @post_set.tag.pretty_name %>. You can <%= link_to "create one", new_wiki_page_path(wiki_page: { title: @post_set.tag.name }), rel: "nofollow" %>.</p>
|
||||
<p>There is no wiki page yet for the tag <%= link_to_wiki @post_set.tag.pretty_name %>. <%= link_to "Create new wiki page", new_wiki_page_path(wiki_page: { title: @post_set.tag.name }), rel: "nofollow" %>.</p>
|
||||
|
||||
<%= render "tag_relationships/alias_and_implication_list", tag: @post_set.tag %>
|
||||
<% end %>
|
||||
|
||||
@@ -93,7 +93,7 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
create(:post, tag_string: "artist:bkub", rating: "s")
|
||||
get posts_path, params: { tags: "bkub" }
|
||||
assert_response :success
|
||||
assert_select "#show-excerpt-link", count: 1, text: "Wiki"
|
||||
assert_select "#show-excerpt-link", count: 1, text: "Artist"
|
||||
|
||||
artist = create(:artist, name: "bkub")
|
||||
get posts_path, params: { tags: "bkub" }
|
||||
@@ -110,13 +110,13 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
|
||||
artist.update(is_banned: false, is_deleted: true)
|
||||
get posts_path, params: { tags: "bkub" }
|
||||
assert_response :success
|
||||
assert_select "#show-excerpt-link", count: 1, text: "Wiki"
|
||||
assert_select "#show-excerpt-link", count: 1, text: "Artist"
|
||||
|
||||
as(@user) { create(:wiki_page, title: "bkub") }
|
||||
get posts_path, params: { tags: "bkub" }
|
||||
assert_response :success
|
||||
assert_select "#show-excerpt-link", count: 1, text: "Wiki"
|
||||
assert_select "#view-wiki-link", count: 1
|
||||
assert_select "#show-excerpt-link", count: 1, text: "Artist"
|
||||
assert_select "#view-wiki-link", count: 0
|
||||
assert_select "#view-artist-link", count: 0
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user