Only show tags if they exist.

master
Nick Sergeant 2012-04-16 18:38:56 -04:00
parent b1b7779309
commit 8d9bdff1e2
2 changed files with 28 additions and 24 deletions

View File

@ -47,20 +47,22 @@
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
<section class="tags"> {% if snipt.tags.all %}
<h2>{{ snipt.tags.all|length }} tag{{ snipt.tags.all|pluralize }}</h2> <section class="tags">
<ul> <h2>{{ snipt.tags.all|length }} tag{{ snipt.tags.all|pluralize }}</h2>
{% for tag in snipt.sorted_tags %} <ul>
<li {% if forloop.counter > 3 and not detail %}class="hidden"{% endif %}> {% for tag in snipt.sorted_tags %}
{% if public %} <li {% if forloop.counter > 3 and not detail %}class="hidden"{% endif %}>
<a href="/public/tag/{{ tag.slug }}/">{{ tag }}</a> {% if public %}
{% else %} <a href="/public/tag/{{ tag.slug }}/">{{ tag }}</a>
<a href="/{{ snipt.user.username }}/tag/{{ tag.slug }}/">{{ tag }}</a> {% else %}
{% endif %} <a href="/{{ snipt.user.username }}/tag/{{ tag.slug }}/">{{ tag }}</a>
</li> {% endif %}
{% endfor %} </li>
</ul> {% endfor %}
</section> </ul>
</section>
{% endif %}
</aside> </aside>
</div> </div>
<footer> <footer>

View File

@ -1,10 +1,12 @@
<section class="tags"> {% if tags %}
<h1>{{ user.username }}'s tags</h1> <section class="tags">
<ul> <h1>{{ user.username }}'s tags</h1>
{% for t in tags %} <ul>
<li> {% for t in tags %}
<a {% if tag.name == t.name %}class="active"{% endif %} href="/{{ user.username }}/tag/{{ t.slug }}/">{{ t.name }} ({{ t.count }})</a> <li>
</li> <a {% if tag.name == t.name %}class="active"{% endif %} href="/{{ user.username }}/tag/{{ t.slug }}/">{{ t.name }} ({{ t.count }})</a>
{% endfor %} </li>
</ul> {% endfor %}
</section> </ul>
</section>
{% endif %}