diff --git a/app/views/posts/index.html.erb b/app/views/posts/index.html.erb index 49509abb2..ead6fd86f 100644 --- a/app/views/posts/index.html.erb +++ b/app/views/posts/index.html.erb @@ -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 @@
The artist requested removal of this page.
<% elsif @post_set.artist.present? %> <%= render "artists/summary", artist: @post_set.artist %> + <% elsif @post_set.tag&.artist? %> +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" %>.
+ + <%= 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| %>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" %>.
+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" %>.
<%= render "tag_relationships/alias_and_implication_list", tag: @post_set.tag %> <% end %> diff --git a/test/functional/posts_controller_test.rb b/test/functional/posts_controller_test.rb index 92658e3a8..0125a09a6 100644 --- a/test/functional/posts_controller_test.rb +++ b/test/functional/posts_controller_test.rb @@ -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