tags.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. {% extends 'base.html' %}
  2. {% block title %}
  3. All Tags · {{ super() }}
  4. {% endblock title %}
  5. {% block head_description %}
  6. All tags used in the {{ SITENAME|striptags }} blog.
  7. {% endblock head_description %}
  8. {% block feed_links %}
  9. {{ super() }}
  10. {% include '_includes/feeds_tags.html' %}
  11. {% endblock feed_links %}
  12. {% block content %}
  13. <div class="row-fluid">
  14. <header class="page-header span10 offset2">
  15. <h1><a href="{{ SITEURL }}/tags.html">All Tags</a></h1>
  16. </header>
  17. </div>
  18. <div class="row-fluid">
  19. <div class="span8 offset2">
  20. <form class="form-search">
  21. <input type="text" class="input-medium search-query filterinput" placeholder="Find a tag">
  22. </form>
  23. <ul class="list-of-tags">
  24. {% for tag, articles in tags|sort %}
  25. <li>
  26. {% set num = articles|count %}
  27. <a href="#{{ tag.slug }}-ref">{{ tag }}<span>{{ num }}</span></a>
  28. </li>
  29. {% endfor %}
  30. </ul>
  31. </div>
  32. </div>
  33. <div class="row-fluid">
  34. <div class="span8 offset2">
  35. {% for tag, articles in tags|sort %}
  36. <h2 id="{{ tag.slug }}-ref" class="tag-title">{{ tag }}</h2>
  37. <ul class="articles-in-tag list-articles-category">
  38. {% for article in articles|sort(reverse = true, attribute = 'date') %}
  39. <li><time pubdate="pubdate" datetime="{{ article.date.isoformat() }}">{{ article.locale_date }}</time><a href="{{ SITEURL }}/{{ article.url }}">{{ article.title }} {%if article.subtitle %} <small> {{ article.subtitle }} </small> {% endif %} </a></li>
  40. {% endfor %}
  41. </ul>
  42. {% endfor %}
  43. </div>
  44. </div>
  45. {% endblock content %}
  46. {% block script %}
  47. {{ super() }}
  48. <script>
  49. (function ($) {
  50. // custom css expression for a case-insensitive contains()
  51. jQuery.expr[':'].Contains = function(a,i,m){
  52. return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
  53. };
  54. function listFilter() {
  55. $('.filterinput')
  56. .change( function () {
  57. var filter = $(this).val();
  58. if(filter) {
  59. // this finds all links in a list that contain the input,
  60. // and hide the ones not containing the input while showing the ones that do
  61. $('.list-of-tags').find("a:not(:Contains(" + filter + "))").parent().hide();
  62. $('.list-of-tags').find("a:Contains(" + filter + ")").parent().show();
  63. } else {
  64. $('.list-of-tags').find("li").show();
  65. }
  66. return false;
  67. })
  68. .keyup( function () {
  69. // fire the above change event after every letter
  70. $(this).change();
  71. });
  72. }
  73. //ondomready
  74. $(function () {
  75. listFilter($());
  76. });
  77. }(jQuery));
  78. </script>
  79. {% endblock script %}