Added redirect for viewing SurveyRecords and enabled links in the Record list.
authorLennard de Rijk <ljvderijk@gmail.com>
Tue, 04 Aug 2009 16:57:27 +0200
changeset 2726 0d9e4b0a9d3c
parent 2725 09b5bfc5707f
child 2727 19e985f09de8
Added redirect for viewing SurveyRecords and enabled links in the Record list. Patch by: Lennard de Rijk and James Levy
app/soc/templates/soc/survey/list/records_heading.html
app/soc/templates/soc/survey/list/records_row.html
app/soc/views/helper/redirects.py
--- 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())