Skip to content

Commit

Permalink
Do not show tag when article_count is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
reyesyang committed Mar 3, 2016
1 parent f2cfd97 commit cb9627b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Expand Up @@ -21,6 +21,6 @@ def join_tags(article)

def cache_key_for_tags
last_updated_at = Tag.maximum(:updated_at).try(:utc).try(:to_s, :number)
"tags-#{last_updated_at}"
"tags-#{last_updated_at}-v1"
end
end
13 changes: 7 additions & 6 deletions app/views/tags/_tag.html.haml
@@ -1,6 +1,7 @@
- cache tag do
%li{class: tag.draft? ? "tag admin" : "tag"}
= link_to tagging_path(tag), :class=>'aside_tag' do
%span{class: 'label'}= tag.name
%span.count
× #{tag.articles_count}
- if tag.articles_count > 0
- cache tag do
%li{class: tag.draft? ? "tag admin" : "tag"}
= link_to tagging_path(tag), :class=>'aside_tag' do
%span{class: 'label'}= tag.name
%span.count
× #{tag.articles_count}

0 comments on commit cb9627b

Please sign in to comment.