From 5784f10c1e2be71e3fcb4690810ef4eb4bd154a6 Mon Sep 17 00:00:00 2001 From: nishanth Date: Wed, 3 Mar 2010 11:19:42 +0530 Subject: now requested mentors can see unpublished task but not comment on it. --- taskapp/views/task.py | 4 +- templates/task/addmentor.html | 4 +- templates/task/view.html | 263 +++++++++++++++++++++--------------------- 3 files changed, 139 insertions(+), 132 deletions(-) diff --git a/taskapp/views/task.py b/taskapp/views/task.py index 195d98e..f9c95ea 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -82,7 +82,9 @@ def view_task(request, tid): claimed_users = task.claimed_users.all() - context['task_viewable'] = True if ( task.status != "UP" ) or is_mentor else False + task_viewable = True if ( task.status != "UP" ) or is_mentor or user.request_sent_to.filter(is_valid=True,is_replied=False,role="MT",task=task)else False + if not task_viewable: + return show_msg(user, "You are not authorised to view this task", "/task/browse/", "browse the tasks") context['can_publish'] = True if task.status == "UP" and user == task.created_by else False context['can_edit'] = True if task.status == "UP" and is_mentor else False diff --git a/templates/task/addmentor.html b/templates/task/addmentor.html index 1c6c1d4..2db13c9 100644 --- a/templates/task/addmentor.html +++ b/templates/task/addmentor.html @@ -3,9 +3,9 @@ Click here to return to the task.

Requesting a user to act as a mentor for the task sends him a request. If he accepts the request, he will also be the mentor for this task {% ifequal task.status "UP" %} - and can view/editlearn more the task. But only the creator of a task can publish the task. + and can view/editlearn more the task. But only the creator of a task can publish the task. {% else %} - and will have all the rightslearn more you posses over the task. + and will have all the rightslearn more you posses over the task. {% endifequal %}

diff --git a/templates/task/view.html b/templates/task/view.html index c95fe13..aef0083 100644 --- a/templates/task/view.html +++ b/templates/task/view.html @@ -3,165 +3,170 @@ {{task.title}} {% endblock %} {% block content %} - {% if task_viewable %} -

{{ task.title }}


+

{{ task.title }}

- {% if can_edit %} - Edit task - {% endif %} - - {% if can_publish %} - Publish task - {% endif %} - - {% if can_close %} - Close this task - {% endif %} - - {% if can_delete %} - Delete task - {% endif %} + {% if can_edit %} + Edit task + {% endif %} + + {% if can_publish %} + Publish task + {% endif %} + + {% if can_close %} + Close this task + {% endif %} + + {% if can_delete %} + Delete task + {% endif %} -
created by {{ task.created_by.username }} - on {{task.creation_datetime|date:"D d M Y"}} at {{task.creation_datetime|time:"H:i"}}
- +
created by {{ task.created_by.username }} + on {{task.creation_datetime|date:"D d M Y"}} at {{task.creation_datetime|time:"H:i"}}
+ + {% ifequal task.status "UP" %} + Task can be viewed by: + {% else %} + Mentors: + {% endifequal %} + + {% for mentor in mentors %} + {{mentor.username}} + {% endfor %} + + {% if can_mod_mentors %} + {% ifequal task.status "UP" %} - Task can be viewed by: + Request others to view/edit the task {% else %} - Mentors: - {% endifequal %} - - {% for mentor in mentors %} - {{mentor.username}} + Add another Mentor to this task + {% endifequal %} + {% endif %} +
+ +
+ Description:
+ {{ task.desc|linebreaksbr }} +


+ {% if task.tags.count %} + Tags: + {% for tag in task.tags %} + {{tag}} {% endfor %} - - {% if can_mod_mentors %} - - {% ifequal task.status "UP" %} - Request others to view/edit the task - {% else %} - Add another Mentor to this task - {% endifequal %} - {% endif %} -
-
- Description:
- {{ task.desc|linebreaksbr }} -


- {% if task.tags.count %} - Tags: - {% for tag in task.tags %} - {{tag}} - {% endfor %} -
- {% endif %} + {% endif %} - {% if deps %} + {% if deps %} + +
The task has following dependencies. -
The task has following dependencies.