FIX: Hide empty popular/recent sections in 404 page (#10811)

This commit is contained in:
Penar Musaraj
2020-10-02 15:11:15 -04:00
committed by GitHub
parent e363b113a8
commit 97f34d7b71

View File

@ -1,20 +1,24 @@
<div class="row page-not-found-topics"> <div class="row page-not-found-topics">
<div class="popular-topics"> <% if @top_viewed.count > 0 %>
<h2 class="popular-topics-title"><%= t 'page_not_found.popular_topics' %></h2> <div class="popular-topics">
<% @top_viewed.each do |t| %> <h2 class="popular-topics-title"><%= t 'page_not_found.popular_topics' %></h2>
<div class='not-found-topic'> <% @top_viewed.each do |t| %>
<%= link_to emoji_codes_to_img(t.fancy_title), t.relative_url %><%= category_badge(t.category) %> <div class='not-found-topic'>
</div> <%= link_to emoji_codes_to_img(t.fancy_title), t.relative_url %><%= category_badge(t.category) %>
<% end %> </div>
<a href="<%= path "/top" %>" class="btn btn-default"><%= t 'page_not_found.see_more' %>&hellip;</a> <% end %>
</div> <a href="<%= path "/top" %>" class="btn btn-default"><%= t 'page_not_found.see_more' %>&hellip;</a>
<div class="recent-topics"> </div>
<h2 class="recent-topics-title"><%= t 'page_not_found.recent_topics' %></h2> <% end %>
<% @recent.each do |t| %> <% if @recent.count > 0 %>
<div class='not-found-topic'> <div class="recent-topics">
<%= link_to t.title, t.relative_url %><%= category_badge(t.category) %> <h2 class="recent-topics-title"><%= t 'page_not_found.recent_topics' %></h2>
</div> <% @recent.each do |t| %>
<% end %> <div class='not-found-topic'>
<a href="<%= path "/latest" %>" class="btn btn-default"><%= t 'page_not_found.see_more' %>&hellip;</a> <%= link_to t.title, t.relative_url %><%= category_badge(t.category) %>
</div> </div>
<% end %>
<a href="<%= path "/latest" %>" class="btn btn-default"><%= t 'page_not_found.see_more' %>&hellip;</a>
</div>
<% end %>
</div> </div>