categories.html 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. {% extends "base.html" %}
  2. {% block title %}
  3. All Categories - {{ super() }}
  4. {% endblock title %}
  5. {% block content %}
  6. <script language="javascript" type="text/javascript">
  7. function uncollapse() {
  8. $(window.location.hash).collapse({
  9. toggle: true
  10. })
  11. }
  12. </script>
  13. <div class="row-fluid">
  14. <header class="page_header span10 offset2">
  15. <h1>All Categories</h1>
  16. </header>
  17. </div>
  18. <div class="row-fluid">
  19. <div class="span8 offset2">
  20. <div class="accordion" id="accordion2">
  21. {% for category, articles in categories %}
  22. <div class="accordion-group">
  23. <div class="accordion-heading">
  24. <a class="accordion-toggle list-of-categories" data-toggle="collapse" data-parent="#accordion2" href="#{{ category|replace(' ', '-')|e }}-ref">
  25. {% set num = articles|count %}
  26. {{ category }}<span>{{ num }}</span>
  27. </a>
  28. </div>
  29. <div id="{{ category|replace(' ', '-')|e }}-ref" class="accordion-body collapse">
  30. <div class="accordion-inner">
  31. <ul>
  32. {% for article in articles %}
  33. {% set day = article.date.strftime('%d')|int %}
  34. <li>{{ article.date.strftime('%b') }} {{ day }}{{ article.date.strftime(', %Y') }} <a href="{{ article.url }}">{{ article.title }}</a></li>
  35. {% endfor %}
  36. </ul>
  37. </div>
  38. </div>
  39. </div>
  40. {% endfor %}
  41. </div>
  42. </div>
  43. </div>
  44. <script type="text/javascript" language="JavaScript">
  45. uncollapse();
  46. </script>
  47. {% endblock content %}