diff options
author | nishanth | 2010-02-24 16:08:31 +0530 |
---|---|---|
committer | nishanth | 2010-02-24 16:08:31 +0530 |
commit | d2bb8bee31479c7c4fadfced462d2f876d8a019b (patch) | |
tree | ffa8895ab59ce9921eb4d33972cc5f7cd91e4d4e | |
parent | e5d2242006b9ebba504785f37049d8e07bb4c580 (diff) | |
download | pytask-d2bb8bee31479c7c4fadfced462d2f876d8a019b.tar.gz pytask-d2bb8bee31479c7c4fadfced462d2f876d8a019b.tar.bz2 pytask-d2bb8bee31479c7c4fadfced462d2f876d8a019b.zip |
modified claim_task view to suit the new design
-rw-r--r-- | taskapp/views/task.py | 19 | ||||
-rw-r--r-- | templates/task/claim.html | 8 | ||||
-rw-r--r-- | templates/task/view.html | 15 |
3 files changed, 25 insertions, 17 deletions
diff --git a/taskapp/views/task.py b/taskapp/views/task.py index 3e5119b..df56a1c 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -193,18 +193,19 @@ def claim_task(request, tid): user = request.user task = getTask(tid) claims = Claim.objects.filter(task=task) + + mentors = task.mentors.all() + claimed_users = task.claimed_users.all() is_guest = True if not user.is_authenticated() else False - if user in task.mentors.all(): - is_mentor = True - else: - is_mentor = False + is_mentor = True if user in mentors else False - task_claimable = True if task.status in ["OP", "RE", "CL"] else False - user_can_claim = True if task_claimable and not ( is_guest or is_mentor ) and ( user not in task.claimed_users.all() ) else False - task_claimed = True if task.status == "CL" else False + task_claimable = True if task.status in ["OP", "WR"] else False + user_can_claim = True if task_claimable and not ( is_guest or is_mentor ) and ( user not in claimed_users ) else False + task_claimed = True if claimed_users else False - context = {'is_mentor':is_mentor, + context = {'user':user, + 'is_mentor':is_mentor, 'task':task, 'claims':claims, 'user_can_claim':user_can_claim, @@ -268,4 +269,4 @@ def edit_task(request, tid): and then give the user fields accordingly. """ - return None + task = Task.objects.get(id=tid) diff --git a/templates/task/claim.html b/templates/task/claim.html index c656146..47e24b7 100644 --- a/templates/task/claim.html +++ b/templates/task/claim.html @@ -8,11 +8,15 @@ {{claim.message}}<br /> {% endfor %} {% else %} - There are no claims for this task yet.<br /> + {% if task_claimable%} + There are no claims for this task yet.<br /> + {% else %} + This task cannot be claimed right now. + {% endif %} <a href="/task/view/tid={{task.id}}">Click here</a> to return to the task. {% endif %} {% if task_claimed and is_mentor %} - <a href="/task/assign/tid={{task.id}}">Assign task</a> + <a href="/task/assign/tid={{task.id}}">Select a user to assign the work.</a> {% endif %} {% if user_can_claim %} <hr /> diff --git a/templates/task/view.html b/templates/task/view.html index 9f01594..39f0490 100644 --- a/templates/task/view.html +++ b/templates/task/view.html @@ -17,7 +17,7 @@ edit task goes here and it should contain all those add subs and add deps depending on availability<br /> {% endif %} - {% if deps %} + {% if deps %} <br />The task has following dependencies {% for dep in deps %} <a href="/task/view/tid={{dep.id}}">{{dep.title}}</a><br /> @@ -27,9 +27,9 @@ <a href="/task/remtask/tid={{task.id}}">remove an existing dependency</a> {% endif %} {% else %} - {%if can_mod_tasks %} + {% if can_mod_tasks %} <a href="/task/addtask/tid={{task.id}}">add a subtask/dependency </a> - {%endif%} + {% endif %} {% endif %} <hr> @@ -43,12 +43,15 @@ {% for user in assigned_users %} <a href="/user/view/uid={{user.id}}">{{user.username}}</a>| {% endfor %} + {% if is_mentor %} + <a href="/task/user/remove/">Remove an existing user</a> <br /> + {% endif %} {% endif %} - {%if can_assign_credits%} + {% if can_assign_credits %} <a href="/task/assigncredits/tid={{task.id}}">Assign credits</a> - {%endif%} - {% if not is_guest %} + {% endif %} + {% if not is_guest and task_claimable %} <a href="/task/claim/tid={{task.id}}">View claims</a><br /> {% endif %} |