diff options
author | nishanth | 2010-03-01 05:41:12 +0530 |
---|---|---|
committer | nishanth | 2010-03-01 05:41:12 +0530 |
commit | db389ba427b1b918b125edb85741cb658458afcf (patch) | |
tree | 2bb4c923c23a2b9064dbe87d17412ad968912f95 | |
parent | c3066d484e0934ed328b83974b01abb93a62fce1 (diff) | |
download | pytask-db389ba427b1b918b125edb85741cb658458afcf.tar.gz pytask-db389ba427b1b918b125edb85741cb658458afcf.tar.bz2 pytask-db389ba427b1b918b125edb85741cb658458afcf.zip |
finalised the look of all existing task views .
-rw-r--r-- | taskapp/views/task.py | 48 | ||||
-rw-r--r-- | templates/task/claim.html | 4 | ||||
-rw-r--r-- | templates/task/removetask.html | 1 | ||||
-rw-r--r-- | templates/task/view.html | 4 |
4 files changed, 35 insertions, 22 deletions
diff --git a/taskapp/views/task.py b/taskapp/views/task.py index ba71569..dc54292 100644 --- a/taskapp/views/task.py +++ b/taskapp/views/task.py @@ -283,29 +283,41 @@ def remove_task(request, tid): 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 @@ def close_task(request, tid): 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 --git a/templates/task/claim.html b/templates/task/claim.html index 9368da1..12ed6ab 100644 --- a/templates/task/claim.html +++ b/templates/task/claim.html @@ -13,9 +13,9 @@ There are no claims for this task yet.<br /> Be the first to claim the task.<br /> {% else %} - This task cannot be claimed right now. + The task cannot be claimed at this stage.<br /> {% endif %} - <a href="/task/view/tid={{task.id}}">Click here</a> to return to the task.<br /> + <a href="/task/view/tid={{task.id}}">Click here</a> to view the task.<br /> {% endif %} {% if task_claimed and is_mentor %} <a href="/task/assign/tid={{task.id}}">Select a user to assign the work.</a> diff --git a/templates/task/removetask.html b/templates/task/removetask.html index 47443df..0131520 100644 --- a/templates/task/removetask.html +++ b/templates/task/removetask.html @@ -3,6 +3,7 @@ Remove tasks for {{task.title}} {% endblock %} {% block content %} + <a href="/task/view/tid={{task.id}}">Click here</a> to return to task.<br /> {% if errors %} Please correct the following errors.<br /> {% for err in errors %} diff --git a/templates/task/view.html b/templates/task/view.html index d30290e..324ad06 100644 --- a/templates/task/view.html +++ b/templates/task/view.html @@ -61,8 +61,8 @@ {% else %} {% if subs %} - - <br />The task has following sub tasks.<br /> + This task cannot be claimed.. It exists only to show all of its sub tasks in one place.<br /> + The task has following sub tasks.<br /> {% for sub in subs %} <a href="/task/view/tid={{sub.id}}">{{sub.title}}</a><br /> {% endfor %} |