categories.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {% extends "base.html" %}
  2. {% block title %}
  3. All Categories - {{ super() }}
  4. {% endblock title %}
  5. {% block content %}
  6. <div class="row-fluid">
  7. <header class="page_header span7 offset3">
  8. <h1>All Categories</h1>
  9. </header>
  10. </div>
  11. <div class="row-fluid">
  12. <div class="span7 offset3">
  13. <div class="accordion" id="accordion2">
  14. {% for category, articles in categories %}
  15. <div class="accordion-group">
  16. <div class="accordion-heading">
  17. <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapse{{ category|replace(' ', '_')|e }}">
  18. {% set num = articles|count %}
  19. {{ num }}
  20. {% if num > 1 %}
  21. articles
  22. {% else %}
  23. article
  24. {% endif %}
  25. filed in {{ category }}
  26. </a>
  27. </div>
  28. <div id="collapse{{ category|replace(' ', '_')|e }}" class="accordion-body collapse">
  29. <div class="accordion-inner">
  30. <ul>
  31. {% for article in articles %}
  32. {% set day = article.date.strftime('%d')|int %}
  33. <li>{{ article.date.strftime('%b') }} {{ day }}{{ article.date.strftime(', %Y') }} <a href="{{ article.url }}">{{ article.title }}</a></li>
  34. {% endfor %}
  35. </ul>
  36. </div>
  37. </div>
  38. </div>
  39. {% endfor %}
  40. </div>
  41. </div>
  42. </div>
  43. {% endblock content %}