Added breadcrumbs tag to catalogue_tags library.
authorMarek Stępniowski <marek@stepniowski.com>
Fri, 22 Aug 2008 14:25:37 +0000 (16:25 +0200)
committerMarek Stępniowski <marek@stepniowski.com>
Fri, 22 Aug 2008 14:25:37 +0000 (16:25 +0200)
catalogue/templatetags/catalogue_tags.py
templates/catalogue/breadcrumbs.html [new file with mode: 0644]

index 43713ce..3c75801 100644 (file)
@@ -107,6 +107,15 @@ def authentication_form():
     return LoginForm(prefix='login').as_ul()
 
 
     return LoginForm(prefix='login').as_ul()
 
 
+@register.inclusion_tag('catalogue/breadcrumbs.html')
+def breadcrumbs(tags, search_form=True):
+    from wolnelektury.catalogue.forms import SearchForm
+    context = {'tag_list': tags}
+    if search_form:
+        context['search_form'] = SearchForm(tags=tags)
+    return context
+
+
 @register.tag
 def catalogue_url(parser, token):
     bits = token.split_contents()
 @register.tag
 def catalogue_url(parser, token):
     bits = token.split_contents()
diff --git a/templates/catalogue/breadcrumbs.html b/templates/catalogue/breadcrumbs.html
new file mode 100644 (file)
index 0000000..896d999
--- /dev/null
@@ -0,0 +1,9 @@
+{% load catalogue_tags %}
+<form action="{% url search %}" method="get" accept-charset="utf-8" id="search-form">
+    <ol>
+        {% for tag in tag_list %}
+        <li class="category"><a href="{% catalogue_url tag %}">{{ tag }}</a> | <a href="{% catalogue_url tag_list -tag %}">x</a></li>
+        {% endfor %}
+        <li>{{ search_form.q }} {{ search_form.tags }} <input type="submit" value="Szukaj"/></li>
+    </ol>
+</form>
\ No newline at end of file