The organization proposal list has been significantly changed.
authorLennard de Rijk <ljvderijk@gmail.com>
Wed, 04 Mar 2009 22:35:54 +0000
changeset 1668 e3780ee24322
parent 1667 95bc81b4cd5c
child 1669 47c1048fc4ef
The organization proposal list has been significantly changed. It now redirects to the review page. All reviewed applications are separated from the non-reviewed ones by two lists. This view uses the two new templates submitted in this patch. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/templates/soc/student_proposal/list/detailed_heading.html
app/soc/templates/soc/student_proposal/list/detailed_row.html
app/soc/views/models/organization.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/student_proposal/list/detailed_heading.html	Wed Mar 04 22:35:54 2009 +0000
@@ -0,0 +1,7 @@
+<tr align="left">
+  <th class="first" align="right">Student</th>
+  <th>Title</th>
+  <th>Status</th>
+  <th>Score</th>
+  <th>Last Modified on</th>
+</tr>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/student_proposal/list/detailed_row.html	Wed Mar 04 22:35:54 2009 +0000
@@ -0,0 +1,11 @@
+<tr class="off" onmouseover="this.className='on'" onmouseout="this.className='off'" 
+onclick="document.location.href='{{ list.redirect }}'" name="name">
+  <td align="right"><div class="name"><a class="noul"
+         href="{{ list.redirect }}">{{ list.item.scope.link_id }}</a>
+     </div>
+  </td>
+  <td><div class="title">{{ list.item.title }}</a></div></td>
+  <td><div class="status">{{ list.item.status }}</a></div></td>
+  <td><div class="score">{{ list.item.score }}</a></div></td>
+  <td><div class="date">{{ list.item.last_modified_on }}</a></div></td>
+</tr>
--- a/app/soc/views/models/organization.py	Wed Mar 04 22:24:45 2009 +0000
+++ b/app/soc/views/models/organization.py	Wed Mar 04 22:35:54 2009 +0000
@@ -183,18 +183,47 @@
 
     from soc.views.models import student_proposal as student_proposal_view
 
-    org_entity = org_logic.logic.getFromKeyFields(kwargs)
-
-    filter = {'org' : org_entity,
-              'status': ['new', 'pending', 'accepted']}
+    try:
+      org_entity = self._logic.getFromKeyFieldsOr404(kwargs)
+    except out_of_band.Error, error:
+      return helper.responses.errorResponse(
+          error, request, template=params['error_public'])
 
     list_params = student_proposal_view.view.getParams().copy()
-    list_params['list_description'] = 'List of %s send to %s ' % (
-        list_params['name_plural'], org_entity.name)
-    list_params['list_action'] = (redirects.getPublicRedirect, list_params)
+    list_params['list_row'] = ('soc/%(module_name)s/list/'
+        'detailed_row.html' % list_params)
+    list_params['list_heading'] = ('soc/%(module_name)s/list/'
+        'detailed_heading.html' % list_params)
+
+    ranked_params = list_params.copy()# ranked proposals
+    ranked_params['list_description'] = 'List of %s send to %s ' % (
+        ranked_params['name_plural'], org_entity.name)
+    ranked_params['list_action'] = (redirects.getReviewRedirect, ranked_params)
+
+    filter = {'org' : org_entity,
+              'status': ['pending', 'accepted']}
+
+    # order by descending score
+    order = ['-score']
 
-    return self.list(request, access_type=access_type, page_name=page_name,
-                     params=list_params, filter=filter, **kwargs)
+    prop_list = lists.getListContent(
+        request, ranked_params, filter, order=order, idx=0)
+
+    new_params = list_params.copy() # new proposals
+    new_params['list_description'] = 'List of new %s send to %s ' %(
+        new_params['name_plural'], org_entity.name)
+    new_params['list_action'] = (redirects.getReviewRedirect, new_params)
+
+    filter['status'] = 'new'
+
+    new_list = lists.getListContent(
+        request, new_params, filter, idx=1)
+
+    # fill contents with all the needed lists
+    contents = [prop_list, new_list]
+
+    # call the _list method from base to display the list
+    return self._list(request, list_params, contents, page_name)
 
   @decorators.merge_params
   @decorators.check_access