# HG changeset patch
# User nishanth
# Date 1267402272 -19800
# Node ID a74a32a5a3e1bb8185b5e18f37634cee5fb669af
# Parent c43e0114e593d082cd9ccf7f9befffd8a16e9615
finalised the look of all existing task views .
diff -r c43e0114e593 -r a74a32a5a3e1 taskapp/views/task.py
--- a/taskapp/views/task.py Mon Mar 01 05:18:44 2010 +0530
+++ b/taskapp/views/task.py Mon Mar 01 05:41:12 2010 +0530
@@ -283,29 +283,41 @@
is_guest = True if not user.is_authenticated() else False
if (not is_guest) and user in task.mentors.all():
- deps, subs = task.deps, task.subs
- task_list = deps if task.sub_type == "D" else subs
+ if task.status in ["UP", "LO", "OP"]:
+
+ deps, subs = task.deps, task.subs
+ task_list = deps if task.sub_type == "D" else subs
- if task_list:
- choices = [(_.id,_.title) for _ in task_list ]
- form = ChoiceForm(choices)
+ if task_list:
+ choices = [(_.id,_.title) for _ in task_list ]
+ form = ChoiceForm(choices)
- errors = []
+ errors = []
+
+ context = {
+ 'user':user,
+ 'task':task,
+ 'form':form,
+ }
- if request.method == "POST":
- data = request.POST
- if not data.get('choice', None): errors.append("Please choose a task to remove.")
- if not errors:
- tid = data['choice']
- sub_task = getTask(tid)
- removeTask(task, sub_task)
- return redirect(task_url)
+ if request.method == "POST":
+ data = request.POST
+ if not data.get('choice', None):
+ errors.append("Please choose a task to remove.")
+ context['errors'] = errors
+ if not errors:
+ tid = data['choice']
+ sub_task = getTask(tid)
+ removeTask(task, sub_task)
+ return redirect(task_url)
+ else:
+ return render_to_response('task/removetask.html', context)
else:
- return render_to_response('task/removetask.html', {'user':user, 'form':form, 'errors':errors})
+ return render_to_response('task/removetask.html', context)
else:
- return render_to_response('task/removetask.html', {'user':user, 'form':form, 'errors':errors})
+ return show_msg(user, "The task has no subtasks/dependencies to be removed", task_url, "view the task")
else:
- return show_msg(user, "The task has no subtasks/dependencies to be removed", task_url, "view the task")
+ return show_msg(user, "subtasks/dependencies cannot be removed at this stage", task_url, "view the task")
else:
return show_msg(user, "You are not authorised to do this", task_url, "view the task")
@@ -583,6 +595,6 @@
else:
return render_to_response('task/close.html', context)
else:
- return show_msg(user, "The task is already closed or the task cannot be closed at this stage", task_url, "view the task")
+ return show_msg(user, "The task is either already closed or cannot be closed at this stage", task_url, "view the task")
else:
return show_msg(user, "You are not authorised to do this", task_url, "view the task")
diff -r c43e0114e593 -r a74a32a5a3e1 templates/task/claim.html
--- a/templates/task/claim.html Mon Mar 01 05:18:44 2010 +0530
+++ b/templates/task/claim.html Mon Mar 01 05:41:12 2010 +0530
@@ -13,9 +13,9 @@
There are no claims for this task yet.
Be the first to claim the task.
{% else %}
- This task cannot be claimed right now.
+ The task cannot be claimed at this stage.
{% endif %}
- Click here to return to the task.
+ Click here to view the task.
{% endif %}
{% if task_claimed and is_mentor %}
Select a user to assign the work.
diff -r c43e0114e593 -r a74a32a5a3e1 templates/task/removetask.html
--- a/templates/task/removetask.html Mon Mar 01 05:18:44 2010 +0530
+++ b/templates/task/removetask.html Mon Mar 01 05:41:12 2010 +0530
@@ -3,6 +3,7 @@
Remove tasks for {{task.title}}
{% endblock %}
{% block content %}
+ Click here to return to task.
{% if errors %}
Please correct the following errors.
{% for err in errors %}
diff -r c43e0114e593 -r a74a32a5a3e1 templates/task/view.html
--- a/templates/task/view.html Mon Mar 01 05:18:44 2010 +0530
+++ b/templates/task/view.html Mon Mar 01 05:41:12 2010 +0530
@@ -61,8 +61,8 @@
{% else %}
{% if subs %}
-
-
The task has following sub tasks.
+ This task cannot be claimed.. It exists only to show all of its sub tasks in one place.
+ The task has following sub tasks.
{% for sub in subs %}
{{sub.title}}
{% endfor %}