tags.html 2.6 KB

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