Skip to content

Instantly share code, notes, and snippets.

@jonrohan
Created May 5, 2011 16:38
Show Gist options
  • Save jonrohan/957382 to your computer and use it in GitHub Desktop.
Save jonrohan/957382 to your computer and use it in GitHub Desktop.
{% load doc_tags %}
<div id="{{topic.slug}}" class="topic">
<h2 class="topic-title"><a href="{% url docs-topic topic.slug %}">{{topic}}</a></h2>
<ul class="toc-articles">
{% for article in topic.articles %}
{% if user|can_see:article %}
<li class="toc-article">
<h3 class="article-title"><a href="{% url docs-article topic.slug article.slug %}">{{article}}</a></h3>
<ul class="toc-sections">
{% with article.sections as sections %}
{% for section in sections|slice:":5" %}
{% if user|can_see:section %}
<li class="toc-section">
<a href="{% url docs-article topic.slug article.slug %}#{{section.slug}}">{{section}}</a>
</li>
{% endif %}
{% endfor %}
{% ifnotequal sections|slice:"5:"|length 1 %}
{% for section in sections|slice:"5:" %}
{% if user|can_see:section %}
<li class="toc-section hidden-section" style="display:none;">
<a href="{% url docs-article topic.slug article.slug %}#{{section.slug}}">{{section}}</a>
</li>
{% if forloop.last %}
<li class="toc-section">
<a href="#" class="more-info">{{sections|slice:"5:"|length}} more</a>
<a href="#" class="less-info" style="display:none;">less</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% else %}
{% for section in sections|slice:"5:" %}
{% if user|can_see:section %}
<li class="toc-section">
<a href="{% url docs-article topic.slug article.slug %}#{{section.slug}}">{{section}}</a>
</li>
{% endif %}
{% endfor %}
{% endifnotequal %}
{% endwith %}
</ul>
</li>
{% endif %}
{% endfor %}
</ul>
<span class="tlp"></span>
<span class="trp"></span>
<span class="blp"></span>
<span class="brp"></span>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment