Author: floguy
Date: Sat Sep 20 23:45:31 2008
New Revision: 23
Added:
trunk/things/templates/things/ordering.html
trunk/things/templates/things/search.html
Modified:
trunk/things/templates/things/list.html
trunk/things/templatetags/things_tags.py
trunk/thingsproject/dev.db
Log:
Factored out search and ordering into inclusion tags.
Modified: trunk/things/templates/things/list.html
==============================================================================
--- trunk/things/templates/things/list.html (original)
+++ trunk/things/templates/things/list.html Sat Sep 20 23:45:31 2008
@@ -3,18 +3,8 @@
{% block main_content %}
<p>Order By:</p>
- {% if search_enabled %}
- <form method="GET" action="">
- <input type="text" name="search" value="{{ terms }}" />
- <input type="submit" value="Search" />
- </form>
- {% endif %}
- <ul>
- {% for field in fields %}
- <li><a href="{{ field.full_url_asc }}">{{
field.verbose_name_asc }}</a></li>
- <li><a href="{{ field.full_url_desc }}">{{
field.verbose_name_desc }}</a></li>
- {% endfor %}
- </ul>
+ {% display_search %}
+ {% display_ordering %}
<ul>
{% for item in objects %}
<li><a href="{% item_url url_prefix name_prefix item %}">{{
item }}</a></li>
Added: trunk/things/templates/things/ordering.html
==============================================================================
--- (empty file)
+++ trunk/things/templates/things/ordering.html Sat Sep 20 23:45:31 2008
@@ -0,0 +1,6 @@
+<ul>
+ {% for field in fields %}
+ <li><a href="{{ field.full_url_asc }}">{{ field.verbose_name_asc
}}</a></li>
+ <li><a href="{{ field.full_url_desc }}">{{ field.verbose_name_desc
}}</a></li>
+ {% endfor %}
+</ul>
\ No newline at end of file
Added: trunk/things/templates/things/search.html
==============================================================================
--- (empty file)
+++ trunk/things/templates/things/search.html Sat Sep 20 23:45:31 2008
@@ -0,0 +1,6 @@
+{% if search_enabled %}
+ <form method="GET" action="">
+ <input type="text" name="search" value="{{ terms }}" />
+ <input type="submit" value="Search" />
+ </form>
+{% endif %}
\ No newline at end of file
Modified: trunk/things/templatetags/things_tags.py
==============================================================================
--- trunk/things/templatetags/things_tags.py (original)
+++ trunk/things/templatetags/things_tags.py Sat Sep 20 23:45:31 2008
@@ -11,5 +11,12 @@
'url_prefix': url_prefix,
'pk': item.pk,
})
+register.simple_tag(item_url)
-register.simple_tag(item_url)
\ No newline at end of file
+def display_ordering(context):
+ return {'fields': context['fields']}
+register.inclusion_tag('things/ordering.html',
takes_context=True)(display_ordering)
+
+def display_search(context):
+ return {'search_enabled': context['search_enabled']}
+register.inclusion_tag('things/search.html',
takes_context=True)(display_search)
\ No newline at end of file
Modified: trunk/thingsproject/dev.db
==============================================================================
Binary files. No diff available.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---