diff --git a/app/views/posts/index.html.erb b/app/views/posts/index.html.erb index eb137a53c..63916f681 100644 --- a/app/views/posts/index.html.erb +++ b/app/views/posts/index.html.erb @@ -20,15 +20,15 @@
There is currently no wiki page for the tag "<%= post_set.tag_string %>". You can <%= link_to "create one", new_wiki_page_path(:wiki_page => {:title => post_set.tag_string}) %>.
+ <% elsif post_set.has_blank_wiki? %> +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 }) %>.
- <%= render "tag_relationships/alias_and_implication_list", tag: post_set.tag %> - <% end %> + <%= 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 41cf2c168..8c90bca94 100644 --- a/test/functional/posts_controller_test.rb +++ b/test/functional/posts_controller_test.rb @@ -102,7 +102,7 @@ class PostsControllerTest < ActionDispatch::IntegrationTest context "with a multi-tag search" do should "render" do as(create(:user)) do - create(:post, tag_string: "1girl solo") + create(:post, tag_string: "1girl solo", rating: "s") create(:wiki_page, title: "1girl") end @@ -111,6 +111,23 @@ class PostsControllerTest < ActionDispatch::IntegrationTest assert_select "#show-excerpt-link", count: 0 end + should "show the wiki excerpt if the search has a tag with a wiki" do + as(@user) { create(:wiki_page, title: "1girl") } + create(:post, tag_string: "1girl rating:s") + get posts_path, params: { tags: "1girl rating:s" } + + assert_response :success + assert_select "li.wiki-excerpt-link", count: 1 + end + + should "show the blank wiki excerpt if the search has tag without a wiki" do + create(:post, tag_string: "1girl rating:s") + get posts_path, params: { tags: "1girl rating:s" } + + assert_response :success + assert_select "li.blank-wiki-excerpt-link", count: 1 + end + should "render an error when searching for too many tags" do get posts_path, params: { tags: "1 2 3" }