# HG changeset patch # User nishanth # Date 1266997440 -19800 # Node ID f670de53402be8d872edf1312a869caf7015f853 # Parent e743fe1f0f998b6b5641b45229e6667b0b2be88c modified view task template and view to suit new design. diff -r e743fe1f0f99 -r f670de53402b taskapp/views/task.py --- a/taskapp/views/task.py Wed Feb 24 11:04:11 2010 +0530 +++ b/taskapp/views/task.py Wed Feb 24 13:14:00 2010 +0530 @@ -5,7 +5,7 @@ from pytask.taskapp.models import User, Task, Comment, Claim from pytask.taskapp.forms.task import TaskCreateForm, AddMentorForm, AssignTaskForm -from pytask.taskapp.events.task import createTask, addMentor, publishTask, addSubTask, addClaim, assignTask, getTask +from pytask.taskapp.events.task import createTask, addMentor, publishTask, addSubTask, addClaim, assignTask, getTask, updateTask from pytask.taskapp.views.user import show_msg ## everywhere if there is no task, django should display 500 message.. but take care of that in sensitive views like add mentor and all @@ -33,25 +33,31 @@ task = getTask(tid) comments = Comment.objects.filter(task=task) mentors = task.mentors.all() + subs = task.subs.all() + deps = task.deps.all() errors = [] is_guest = True if not user.is_authenticated() else False is_mentor = True if user in task.mentors.all() else False - - task_claimable = True if task.status in ["OP", "WR"] else False - context = {'user':user, 'task':task, 'comments':comments, 'mentors':mentors, + 'subs':subs, + 'deps':deps, 'is_guest':is_guest, 'is_mentor':is_mentor, 'errors':errors, - } - - assigned_users = task.assigned_users.all() - if assigned_users: - context['assigned_users'] = assigned_users + } + + context['task_viewable'] = True if ( task.status not in ["UP", "DL"] ) or is_mentor else False + context['task_claimable'] = True if task.status in ["OP", "WR"] else False + + context['can_mod_mentors'] = True if task.status in ["UP", "OP", "LO", "WR"] and is_mentor else False + context['can_mod_tasks'] = True if task.status in ["UP", "OP", "LO"] and is_mentor else False + context['can_assign_credits'] = True if task.status in ["OP", "WR"] and is_mentor else False + + context['assigned_users'] = task.assigned_users.all() if request.method == 'POST': if not is_guest: @@ -93,6 +99,7 @@ return render_to_response('task/create.html',{'form':form, 'error_msg':error_msg}) addMentor(task, user) + updateTask(task,tags_field=data['tags_field']) if publish: publishTask(task) task_url = '/task/view/tid=%s'%task.id return redirect(task_url) diff -r e743fe1f0f99 -r f670de53402b templates/task/view.html --- a/templates/task/view.html Wed Feb 24 11:04:11 2010 +0530 +++ b/templates/task/view.html Wed Feb 24 13:14:00 2010 +0530 @@ -3,49 +3,73 @@ {{task.title}} {% endblock %} {% block content %} - Browse tasks -

{{ task.title }}


- - created by {{ task.created_by.username }} on {{ task.creation_datetime.ctime }}
- Mentors: - {% for mentor in mentors %} - {{mentor.username}}| - {% endfor %} - {% if is_mentor %} -
Add another Mentor to this task
- edit task goes here and it should contain all those add subs and add deps depending on availability
- {% endif %} -
-
Description:
-
{{ task.desc }}
-
- status of task is {{task.status}}
- {% if assigned_users %} - Users working on this task: - {% for user in assigned_users %} - {{user.username}}| - {% endfor %} -
- {% endif %} - {% if not is_guest %} - View claims
- {% endif %} - - {% if comments %} -
-
comments:
- {% for comment in comments %} -
{{ comment.created_by.username }} at {{ comment.creation_datetime.ctime }} wrote:
- {{ comment.data }}
+ {% if task_viewable %} + Browse tasks +

{{ task.title }}


+ + created by {{ task.created_by.username }} on {{ task.creation_datetime.ctime }}
+ Mentors: + {% for mentor in mentors %} + {{mentor.username}}| {% endfor %} - {% endif %} + {% if can_mod_mentors %} +
Add another Mentor to this task
+ edit task goes here and it should contain all those add subs and add deps depending on availability
+ {% endif %} - {% if not is_guest %} -
Add comment:
-
- -
- -
+ {% if deps %} +
The task has following dependencies + {% for dep in deps %} + {{dep.title}}
+ {% endfor %} + {% if can_mod_tasks %} + add more tasks + remove an existing task + {% endif %} + {% else %} + {%if can_mod_tasks %} + add a subtask/dependency + {%endif%} + {% endif %} + +
+
Description:
+
{{ task.desc }}
+
+ + status of task is {{task.status}}
+ {% if assigned_users %} + Users working on this task: + {% for user in assigned_users %} + {{user.username}}| + {% endfor %} +
+ {% endif %} + {%if can_assign_credits%} + Assign credits + {%endif%} + {% if not is_guest %} + View claims
+ {% endif %} + + {% if comments %} +
+
comments:
+ {% for comment in comments %} +
{{ comment.created_by.username }} at {{ comment.creation_datetime.ctime }} wrote:
+ {{ comment.data }}
+ {% endfor %} + {% endif %} + + {% if not is_guest %} +
Add comment:
+
+ +
+ +
+ {% endif %} + {% else %} + You are not authorised to view this task. click here to return to browsing the tasks. {% endif %} {% endblock %}