[open-ils-commits] r78 - in servres/trunk/conifer: syrup templates
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Dec 8 22:05:19 EST 2008
Author: artunit
Date: 2008-12-08 22:05:17 -0500 (Mon, 08 Dec 2008)
New Revision: 78
Modified:
servres/trunk/conifer/syrup/models.py
servres/trunk/conifer/templates/search_results.xhtml
Log:
Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py 2008-12-03 18:19:17 UTC (rev 77)
+++ servres/trunk/conifer/syrup/models.py 2008-12-09 03:05:17 UTC (rev 78)
@@ -286,6 +286,23 @@
date_created = m.DateTimeField(auto_now_add=True)
last_modified = m.DateTimeField()
+
+ def title_hl(self, terms):
+ for term in terms:
+ hl_title = highlight(self.title,term)
+ if not hl_title == self.title:
+ return hl_title
+
+ return self.title
+
+ def author_hl(self, terms):
+ for term in terms:
+ hl_author = highlight(self.author,term)
+ if not hl_author == self.author:
+ return hl_author
+
+ return self.author
+
def __unicode__(self):
return self.title
Modified: servres/trunk/conifer/templates/search_results.xhtml
===================================================================
--- servres/trunk/conifer/templates/search_results.xhtml 2008-12-03 18:19:17 UTC (rev 77)
+++ servres/trunk/conifer/templates/search_results.xhtml 2008-12-09 03:05:17 UTC (rev 78)
@@ -16,24 +16,29 @@
</head>
<body>
<h1>${title}</h1>
+ <h3>You searched: <i>${query_string}</i></h3>
+ <p style="font-size: large;">
+ No. of instructors: <i> ${instr_len}</i>
+ </p>
+ <p py:for="foo in instructors" style="font-size: large;">
+ <!--
+ there are a couple of options here
+ ${foo.instr_name()}<br/>
+ ${foo.user.last_name}<br/>
+ -->
- <h3>${query_string}</h3>
- <p py:for="foo in instructors" style="font-size: large;">
- hey ${foo.instr_name()}<br/>
- hey ${foo.user.last_name}<br/>
- <!-- need to figure out how to unescape this -->
- hey ${Markup(foo.instr_name_hl(norm_query))}<br/>
- </p>
- <tr py:def="pageheader()">
- <th>Term</th><!-- <th>Code</th> --><th>Title</th>
- </tr>
- <span py:def="pagerow(item)">
- <td>${item.author}</td>
- <!--
- <td><a href="../course/${item.id}/">${item.code}</a></td>
- -->
- <td>${item.title}</td>
- </span>
- ${pagetable(paginator, count, pagerow, pageheader)}
+ ${Markup(foo.instr_name_hl(norm_query))}<br/>
+ </p>
+
+ <tr py:def="pageheader()">
+ <th>Author</th><th>Title</th>
+ </tr>
+
+ <span py:def="pagerow(item)">
+ <td>${Markup(item.author_hl(norm_query))}</td>
+ <td>${Markup(item.title_hl(norm_query))}</td>
+ </span>
+ ${pagetable(paginator, count, pagerow, pageheader)}
+
</body>
</html>
More information about the open-ils-commits
mailing list