Added redirect for viewing SurveyRecords and enabled links in the Record list.
Patch by: Lennard de Rijk and James Levy
--- a/app/soc/templates/soc/survey/list/records_heading.html Tue Aug 04 16:52:41 2009 +0200
+++ b/app/soc/templates/soc/survey/list/records_heading.html Tue Aug 04 16:57:27 2009 +0200
@@ -1,5 +1,5 @@
<tr align="left">
<th>Taken By</th>
<th>Taken On</th>
- <th>Preview: {{ first_question|truncatewords:7 }}</th>
+ <th>Preview Question: {{ first_question|truncatewords:7 }}</th>
</tr>
--- a/app/soc/templates/soc/survey/list/records_row.html Tue Aug 04 16:52:41 2009 +0200
+++ b/app/soc/templates/soc/survey/list/records_row.html Tue Aug 04 16:57:27 2009 +0200
@@ -1,5 +1,5 @@
<tr class="off" onmouseover="this.className='on'; do_redirect=true" onmouseout="this.className='off'"
-onclick="return false; if (do_redirect) document.location.href='{{ list.redirect }}'" name="name">
+ onclick="if (do_redirect) document.location.href='{{ list.redirect }}'" name="name">
<td>
<div class="author">
--- a/app/soc/views/helper/redirects.py Tue Aug 04 16:52:41 2009 +0200
+++ b/app/soc/views/helper/redirects.py Tue Aug 04 16:57:27 2009 +0200
@@ -421,6 +421,22 @@
entity.key().id_or_name())
+def getViewSurveyRecordRedirect(entity, params):
+ """Returns the redirect for view a Survey Record
+ for the given Survey Record.
+
+ Args:
+ entity: a Survey Record entity
+ params: params for a Survey view
+
+ """
+
+ return '/%s/record/%s?id=%s' % (
+ params['url_name'],
+ entity.survey.key().id_or_name(),
+ entity.key().id_or_name())
+
+
def getEditGradingRecordRedirect(entity, params):
"""Returns the redirect for editing a given GradingRecord.
"""
@@ -449,3 +465,10 @@
return None
return getPublicRedirect(tos_doc, {'url_name': 'document'})
+
+
+def getSubscribeRedirect(entity, params):
+ """Redirects to subscription XML doc for an entity
+ """
+ return'/%s/subscribe/%s' % (
+ params['url_name'], entity.key().name())