The process_request template now properly differentiate between a request in "new" and "group_accepted" state.
authorLennard de Rijk <ljvderijk@gmail.com>
Sun, 08 Mar 2009 20:07:22 +0000
changeset 1756 0a332ff872bf
parent 1755 972c546f0810
child 1757 0f909179ccf2
The process_request template now properly differentiate between a request in "new" and "group_accepted" state. Should solve issue 237. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/templates/soc/request/process_request.html
app/soc/views/models/role.py
--- a/app/soc/templates/soc/request/process_request.html	Sun Mar 08 19:12:17 2009 +0000
+++ b/app/soc/templates/soc/request/process_request.html	Sun Mar 08 20:07:22 2009 +0000
@@ -21,11 +21,14 @@
 {% block body %}
 <p>
 <div="text"> 
-This is a request from {{ entity.link_id }} to become a {{ entity.role_verbose }} for {{entity.scope.name }}. 
-Please select your response.
+{% ifequal request_status "new" %}
+  This is a request from <b>{{ entity.link_id }}</b> to become a 
+  <b>{{ entity.role_verbose }}</b> for <b>{{entity.scope.name }}</b>.</br>
+  Please select your response by using the buttons below.
 </div>
 </p>
 
+<table>
 <tr>
   <td>
     <input type="button" onclick="location.href='/{{ module_name }}/process_request/{{ entity.scope_path }}/{{ entity.link_id }}?status=group_accepted'" value="Accept"/>
@@ -34,5 +37,22 @@
   </td>
 </tr>
 </table>
+{% else %}
+<p>
+<div="text"> 
+  This is a invite to <b>{{ entity.link_id }}</b> to become a 
+  <b>{{ entity.role_verbose }}</b> for <b>{{entity.scope.name }}</b>.<br/> 
+  If you would like to withdraw this invite please press the withdraw button below.
+</div>
+</p>
 
-{% endblock %}
+<table>
+<tr>
+  <td>
+    <input type="button" onclick="location.href='/{{ module_name }}/process_request/{{ entity.scope_path }}/{{ entity.link_id }}?status=rejected'" value="Withdraw"/>
+    <input type="button" value="Back to Previous Page" onClick="javascript: history.go(-1)">
+  </td>
+</tr>
+</table>
+{% endifequal %}
+{% endblock body %}
--- a/app/soc/views/models/role.py	Sun Mar 08 19:12:17 2009 +0000
+++ b/app/soc/views/models/role.py	Sun Mar 08 20:07:22 2009 +0000
@@ -603,9 +603,9 @@
         'scope_path': kwargs['scope_path'],
         'role': params['module_name']}
     request_entity = request_logic.logic.getForFields(fields, unique=True)
-    
+
     get_dict = request.GET
-    
+
     if 'status' in get_dict.keys():
       if get_dict['status'] in ['group_accepted', 'rejected', 'ignored']:
         # update the request_entity and redirect away from this page
@@ -630,6 +630,7 @@
 
     # put the entity in the context
     context['entity'] = request_entity
+    context['request_status'] = request_entity.status 
     context['module_name'] = params['module_name']
 
     #display the request processing page using the appropriate template