From: artunit
Date: Tue, 9 Dec 2008 03:05:17 +0000 (+0000)
Subject: git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@78 6d9bc8c9-1ec2-4278...
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7ea1e08e89f6c3a2ba2edc474eb04b4aa8e2a8ee;p=Syrup.git
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@78 6d9bc8c9-1ec2-4278-b937-99fde70a366f
---
diff --git a/conifer/syrup/models.py b/conifer/syrup/models.py
index 964a2cd..6953894 100644
--- a/conifer/syrup/models.py
+++ b/conifer/syrup/models.py
@@ -286,6 +286,23 @@ class Item(m.Model):
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
diff --git a/conifer/templates/search_results.xhtml b/conifer/templates/search_results.xhtml
index f1a6da3..84282a7 100644
--- a/conifer/templates/search_results.xhtml
+++ b/conifer/templates/search_results.xhtml
@@ -16,24 +16,29 @@ instructors = instructor_list
${title}
+ You searched: ${query_string}
+
+ No. of instructors: ${instr_len}
+
+
+
-
${query_string}
-
- hey ${foo.instr_name()}
- hey ${foo.user.last_name}
-
- hey ${Markup(foo.instr_name_hl(norm_query))}
-
-
- Term | Title |
-
-
- ${item.author} |
-
- ${item.title} |
-
- ${pagetable(paginator, count, pagerow, pageheader)}
+ ${Markup(foo.instr_name_hl(norm_query))}
+
+
+
+ Author | Title |
+
+
+
+ ${Markup(item.author_hl(norm_query))} |
+ ${Markup(item.title_hl(norm_query))} |
+
+ ${pagetable(paginator, count, pagerow, pageheader)}
+