tags.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 %}
  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 %}
  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="{{ article.url }}">{{ article.title }}</a></li>
  36. {% endfor %}
  37. </ul>
  38. {% endfor %}
  39. </div>
  40. </div>
  41. {% endblock content %}
  42. {% block script %}
  43. {{ super() }}
  44. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  45. <script>
  46. (function ($) {
  47. // custom css expression for a case-insensitive contains()
  48. jQuery.expr[':'].Contains = function(a,i,m){
  49. return (a.textContent || a.innerText || "").toUpperCase().indexOf(m[3].toUpperCase())>=0;
  50. };
  51. function listFilter() {
  52. $('.filterinput')
  53. .change( function () {
  54. var filter = $(this).val();
  55. if(filter) {
  56. // this finds all links in a list that contain the input,
  57. // and hide the ones not containing the input while showing the ones that do
  58. $('.list-of-tags').find("a:not(:Contains(" + filter + "))").parent().hide();
  59. $('.list-of-tags').find("a:Contains(" + filter + ")").parent().show();
  60. } else {
  61. $('.list-of-tags').find("li").show();
  62. }
  63. return false;
  64. })
  65. .keyup( function () {
  66. // fire the above change event after every letter
  67. $(this).change();
  68. });
  69. }
  70. //ondomready
  71. $(function () {
  72. listFilter($());
  73. });
  74. }(jQuery));
  75. </script>
  76. {% endblock script %}