categories.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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" data-toggle="collapse" data-parent="#accordion2" href="#{{ category|replace(' ', '-')|e }}-ref">
  25. {% set num = articles|count %}
  26. {{ num }}
  27. {% if num > 1 %}
  28. articles
  29. {% else %}
  30. article
  31. {% endif %}
  32. filed in {{ category }}
  33. </a>
  34. </div>
  35. <div id="{{ category|replace(' ', '-')|e }}-ref" class="accordion-body collapse">
  36. <div class="accordion-inner">
  37. <ul>
  38. {% for article in articles %}
  39. {% set day = article.date.strftime('%d')|int %}
  40. <li>{{ article.date.strftime('%b') }} {{ day }}{{ article.date.strftime(', %Y') }} <a href="{{ article.url }}">{{ article.title }}</a></li>
  41. {% endfor %}
  42. </ul>
  43. </div>
  44. </div>
  45. </div>
  46. {% endfor %}
  47. </div>
  48. </div>
  49. </div>
  50. <script type="text/javascript" language="JavaScript">
  51. uncollapse();
  52. </script>
  53. {% endblock content %}