From 3ce8f6e7df613d5216309769433952f56adfeac0 Mon Sep 17 00:00:00 2001 From: evazion Date: Fri, 15 Dec 2017 11:51:53 -0600 Subject: [PATCH] /wiki_pages/show_or_new: show post count in navbar if tag exists (#3410). 649969156 hid the post count in the navbar on /wiki_pages/new, but that also hid the count for /wiki_pages/show_or_new?title=medium_hair, which was wrong. Show the count when the tag exists. --- app/views/wiki_pages/_secondary_links.html.erb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/wiki_pages/_secondary_links.html.erb b/app/views/wiki_pages/_secondary_links.html.erb index 17f9a5758..a95eb10d0 100644 --- a/app/views/wiki_pages/_secondary_links.html.erb +++ b/app/views/wiki_pages/_secondary_links.html.erb @@ -10,7 +10,10 @@
  • <%= link_to "Help", wiki_pages_path(:search => {:title => "help:wiki"}) %>
  • - <% if @wiki_page && !@wiki_page.new_record? %> + <% if @wiki_page && @wiki_page.new_record? && @wiki_page.try(:tag).present? %> +
  • |
  • +
  • <%= link_to "Posts (#{@wiki_page.tag.post_count})", posts_path(:tags => @wiki_page.title) %>
  • + <% elsif @wiki_page && !@wiki_page.new_record? %>
  • |
  • <%= link_to "Posts (#{@wiki_page.tag.try(:post_count) || 0})", posts_path(:tags => @wiki_page.title) %>
  • <%= link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %>