diff options
author | Madhusudan.C.S | 2011-01-16 23:17:13 +0530 |
---|---|---|
committer | Madhusudan.C.S | 2011-01-16 23:17:13 +0530 |
commit | 6494877ea0fda88275aec98ea78ab8261f1db35d (patch) | |
tree | 9e574ca089e459e721bdab22afd4603cf4ec9cb9 | |
parent | a3ef82b82700dfb2ef42a80cb943cc4dac3a7839 (diff) | |
download | pytask-6494877ea0fda88275aec98ea78ab8261f1db35d.tar.gz pytask-6494877ea0fda88275aec98ea78ab8261f1db35d.tar.bz2 pytask-6494877ea0fda88275aec98ea78ab8261f1db35d.zip |
Huh, please don't tell me I will have to refactor so much code again.
-rw-r--r-- | pytask/templates/task/addreviewer.html | 12 | ||||
-rw-r--r-- | pytask/templates/task/approved_task.html | 8 | ||||
-rw-r--r-- | pytask/templates/task/approved_textbook.html | 7 | ||||
-rw-r--r-- | pytask/templates/task/browse.html | 3 | ||||
-rw-r--r-- | pytask/templates/task/browse_textbooks.html | 3 | ||||
-rw-r--r-- | pytask/templates/task/claim.html | 14 | ||||
-rw-r--r-- | pytask/templates/task/confirm_approval.html | 22 | ||||
-rw-r--r-- | pytask/templates/task/confirm_textbook_approval.html | 22 | ||||
-rw-r--r-- | pytask/templates/task/edit.html | 3 | ||||
-rw-r--r-- | pytask/templates/task/select_user.html | 16 | ||||
-rw-r--r-- | pytask/templates/task/submit_report.html | 13 | ||||
-rw-r--r-- | pytask/templates/task/view.html | 154 | ||||
-rw-r--r-- | pytask/templates/task/view_report.html | 15 | ||||
-rw-r--r-- | pytask/templates/task/view_textbook.html | 11 | ||||
-rw-r--r-- | pytask/templates/task/view_work.html | 44 | ||||
-rw-r--r-- | pytask/templates/templatetags/_as_div_form.html | 7 | ||||
-rw-r--r-- | pytask/templatetags/form_helpers.py | 4 |
17 files changed, 209 insertions, 149 deletions
diff --git a/pytask/templates/task/addreviewer.html b/pytask/templates/task/addreviewer.html index b497390..f2974ed 100644 --- a/pytask/templates/task/addreviewer.html +++ b/pytask/templates/task/addreviewer.html @@ -1,9 +1,7 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block content %} - Select a user as a reviewer for this task.<br /> - <form action="" method="POST"> - {% csrf_token %} - {{form.as_table}} - <input type="submit" value="Select"> - </form> + Select a user as a reviewer for this task.<br /> + + {% as_div_form form "Add Reviewer Form" csrf_token "Select" %} {% endblock %} diff --git a/pytask/templates/task/approved_task.html b/pytask/templates/task/approved_task.html index 2cbf7f8..5abb86d 100644 --- a/pytask/templates/task/approved_task.html +++ b/pytask/templates/task/approved_task.html @@ -1,5 +1,9 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block content %} -The task <a href="{% url view_task task.id %}">{{task.title}}</a> has been approved.<br /> +The task <a href="{% url view_task task.id %}">{{task.title}}</a> +has been approved. +<br /> + The task will be public. Now users can claim the task and work on it. {% endblock %} diff --git a/pytask/templates/task/approved_textbook.html b/pytask/templates/task/approved_textbook.html index 7c1a405..b3a118f 100644 --- a/pytask/templates/task/approved_textbook.html +++ b/pytask/templates/task/approved_textbook.html @@ -1,5 +1,8 @@ -{% extends 'base.html' %} +{% extends "base.html" %} {% block content %} -The textbook <a href="{% url view_textbook textbook.id %}">{{textbook.name}}</a> has been approved.<br /> +The textbook <a href="{% url view_textbook textbook.id %}"> +{{textbook.name}}</a> has been approved. +<br /> + The textbook will now be public. {% endblock %} diff --git a/pytask/templates/task/browse.html b/pytask/templates/task/browse.html index 9eeb7d5..c8823f1 100644 --- a/pytask/templates/task/browse.html +++ b/pytask/templates/task/browse.html @@ -1,4 +1,5 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block content %} {% if open_tasks %} diff --git a/pytask/templates/task/browse_textbooks.html b/pytask/templates/task/browse_textbooks.html index 23f081d..1e5cbb0 100644 --- a/pytask/templates/task/browse_textbooks.html +++ b/pytask/templates/task/browse_textbooks.html @@ -1,4 +1,5 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block content %} {% if comp_textbooks %} Textbooks that were completed recently<ul> diff --git a/pytask/templates/task/claim.html b/pytask/templates/task/claim.html index 5de333d..e64a864 100644 --- a/pytask/templates/task/claim.html +++ b/pytask/templates/task/claim.html @@ -1,4 +1,5 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block content %} {% if can_claim %} Propose a claim to work on this task.<br /> @@ -27,13 +28,10 @@ {% endif %} {% if can_claim %} - <hr /> - <form action="" method="post"> - {% csrf_token %} - {{form.as_p}} - <input type="submit" value="Submit Claim"><br /> - Please note that you can claim only once and so write your proposal carefully.<br /> - </form> + <hr /> + Please note that you can claim only once and so write your + proposal carefully.<br /> + {% as_div_form form "Task Claim Form" csrf_token "Request Claim" %} {% endif %} {% endblock %} diff --git a/pytask/templates/task/confirm_approval.html b/pytask/templates/task/confirm_approval.html index a3d8448..c72554d 100644 --- a/pytask/templates/task/confirm_approval.html +++ b/pytask/templates/task/confirm_approval.html @@ -1,8 +1,20 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block content %} -You are about to approve the task <a href="{% url view_task task.id %}">{{task.title}}</a><br /> -This action cannot be undone. Please confirm <br /> <br /> + You are about to approve the task <a href="{% url view_task task.id %}"> + {{task.title}}</a> + <br /> + This action cannot be undone. Please confirm + <br /><br /> + + <a href="{% url approve_task task.id %}"> + Yes, I approve the task + </a> + <br /> + + <a href="{% url view_task task.id %}"> + No, take me back to the task + </a> + <br /> -<a href="{% url approve_task task.id %}">Yes, I approve the task</a><br /> -<a href="{% url view_task task.id %}">No, take me back to the task</a> <br /> {% endblock %} diff --git a/pytask/templates/task/confirm_textbook_approval.html b/pytask/templates/task/confirm_textbook_approval.html index 0845276..b051e36 100644 --- a/pytask/templates/task/confirm_textbook_approval.html +++ b/pytask/templates/task/confirm_textbook_approval.html @@ -1,8 +1,20 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block content %} -You are about to approve the textbook <a href="{% url view_textbook textbook.id %}">{{textbook.name}}</a><br /> -This action cannot be undone. Please confirm <br /> <br /> +You are about to approve the textbook +<a href="{% url view_textbook textbook.id %}">{{textbook.name}}</a> +<br /> + +This action cannot be undone. Please confirm +<br /> <br /> + +<a href="{% url approve_textbook textbook.id %}"> + Yes, I approve the textbook +</a> +<br /> -<a href="{% url approve_textbook textbook.id %}">Yes, I approve the textbook</a><br /> -<a href="{% url view_textbook textbook.id %}">No, take me back to the textbook</a> <br /> +<a href="{% url view_textbook textbook.id %}"> + No, take me back to the textbook +</a> +<br /> {% endblock %} diff --git a/pytask/templates/task/edit.html b/pytask/templates/task/edit.html index 1517dcb..2a0a48e 100644 --- a/pytask/templates/task/edit.html +++ b/pytask/templates/task/edit.html @@ -1,4 +1,5 @@ {% extends "base.html" %} + {% load form_helpers %} {% block css %} @@ -19,5 +20,5 @@ {% endblock %} {% block content %} - {% as_div_form form "Create Task Form" csrf_token "" "Submit" %} + {% as_div_form form "Create Task Form" csrf_token "Submit" %} {% endblock %} diff --git a/pytask/templates/task/select_user.html b/pytask/templates/task/select_user.html index 501c474..4e64fac 100644 --- a/pytask/templates/task/select_user.html +++ b/pytask/templates/task/select_user.html @@ -1,10 +1,10 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block content %} - <a href="{% url claim_task task.id %}">click here</a> to return to the claims page.<br /><br /> - Select a user to assign this task.<br /> - <form action="" method="POST"> - {% csrf_token %} - {{form.as_table}} - <input type="submit" value="Assign Task"> - </form> + <a href="{% url claim_task task.id %}"> + Click here + </a> to return to the claims page. + <br /><br /> + Select a user to assign this task.<br /> + {% as_div_form form "Assign Task Form" csrf_token "Assign Task" %} {% endblock %} diff --git a/pytask/templates/task/submit_report.html b/pytask/templates/task/submit_report.html index c8d4bfd..c056705 100644 --- a/pytask/templates/task/submit_report.html +++ b/pytask/templates/task/submit_report.html @@ -1,12 +1,9 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block title %} - {{task.title}} + {{task.title}} {% endblock %} + {% block content %} -Submit a report: <br /> -<form action='' method=post enctype="multipart/form-data"> - {% csrf_token %} -{{ form.as_p }} -<input type=submit value=submit /> -</form> + {% as_div_form form "Submit Report" csrf_token "Submit" "" "True" %} {% endblock %} diff --git a/pytask/templates/task/view.html b/pytask/templates/task/view.html index 8165c51..5eb1bd3 100644 --- a/pytask/templates/task/view.html +++ b/pytask/templates/task/view.html @@ -1,82 +1,98 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block title %} - {{task.title}} + {{task.title}} {% endblock %} + {% block content %} - <h3>{{ task.title }}</h3> + <h3>{{ task.title }}</h3> + + {% if can_edit %} + <a href="{% url edit_task task.id %}">Edit task</a> + {% endif %} - {% if can_edit %} - <a href="{% url edit_task task.id %}">Edit task</a> - {% endif %} + {% if can_approve %} + <a href="{% url approve_task task.id %}">Approve task</a> + {% endif %} - {% if can_approve %} - <a href="{% url approve_task task.id %}">Approve task</a> - {% endif %} + {% if can_close %} + <a href="{% url close_task task.id %}">Close task</a> + {% endif %} - {% if can_close %} - <a href="{% url close_task task.id %}">Close task</a> - {% endif %} + <hr />created by + <a href="{% url view_user_profile task.created_by.id %}"> + {{ task.created_by.username }} + </a> + on {{task.creation_datetime|date:"D d M Y"}} at + {{task.creation_datetime|time:"H:i"}} + <br /> - <hr />created by <a href="{% url view_user_profile task.created_by.id %}">{{ task.created_by.username }}</a> - on {{task.creation_datetime|date:"D d M Y"}} at {{task.creation_datetime|time:"H:i"}}<br /> - - {% if reviewers %} + {% if reviewers %} Reviewers: - {% for reviewer in reviewers %} - <a href="{% url view_user_profile reviewer.id %}">{{reviewer.username}}</a> - {% endfor %} - {% endif %} - - {% if can_mod_reviewers %} - <a href="{% url addreviewer_task task.id %}"> - Add a Reviewer to this task</a> - {% endif %} - <br /> - - <hr /> - <b>Description:</b><br /> - {{ task.desc|linebreaksbr }} - <br /><br /><hr /> - {% if task.tags.count %} - Tags: - {% for tag in task.tags %} - {{tag}} - {% endfor %} - <hr /> - {% endif %} - - {% if selected_users %} - Users working on this task: - {% for user in selected_users %} - <a href="{% url view_profile user.id %}">{{user.username}}</a> - {% endfor %} - <br /> - {% endif %} - - {% if task_claimable %} - <a href="{% url claim_task task.id %}">View claims</a> - {% endif %} - - <a href="{% url view_work task.id %}">View submitted work reports</a> - - <hr /> - {% if comments %} - comments:<br /><br /> - {% for comment in comments %} - <a href="{% url view_profile comment.commented_by.id %}">{{ comment.commented_by.username }}</a> - on {{ comment.comment_datetime|date:"D d M Y"}} at {{comment.comment_datetime|time:"H:i"}} wrote:<br /> - {{ comment.data|linebreaksbr }}<br /> - {% endfor %} - {% endif %} + {% for reviewer in reviewers %} + <a href="{% url view_user_profile reviewer.id %}">{{reviewer.username}}</a> + {% endfor %} + {% endif %} + + {% if can_mod_reviewers %} + <a href="{% url addreviewer_task task.id %}"> + Add a Reviewer to this task</a> + {% endif %} + <br /> + + <hr /> + <b>Description:</b><br /> + + {{ task.desc|linebreaksbr }} + <br /><br /><hr /> + + {% if task.tags.count %} + + Tags: + {% for tag in task.tags %} + {{tag}} + {% endfor %} <hr /> - {% if can_comment %} + {% endif %} + + {% if selected_users %} + + Users working on this task: + {% for user in selected_users %} + <a href="{% url view_profile user.id %}">{{user.username}}</a> + {% endfor %} + <br /> + + {% endif %} + + {% if task_claimable %} + <a href="{% url claim_task task.id %}">View claims</a> + {% endif %} + + <a href="{% url view_work task.id %}">View submitted work reports</a> + <hr /> + + + {% if comments %} + + comments:<br /><br /> + {% for comment in comments %} + <a href="{% url view_profile comment.commented_by.id %}"> + {{ comment.commented_by.username }} + </a> + on {{ comment.comment_datetime|date:"D d M Y"}} at + {{comment.comment_datetime|time:"H:i"}} wrote: + <br /> + {{ comment.data|linebreaksbr }}<br /> + {% endfor %} + + {% endif %} + <hr /> + + {% if can_comment %} Add comment:<br /> - <form action="" method="post"> - {% csrf_token %} - {{form.as_p}} - <input type="submit" value="Submit"> - </form> - {% endif %} + {% as_div_form form "Comment Form" csrf_token "Submit" %} + {% endif %} {% endblock %} diff --git a/pytask/templates/task/view_report.html b/pytask/templates/task/view_report.html index 16ef0a5..9627468 100644 --- a/pytask/templates/task/view_report.html +++ b/pytask/templates/task/view_report.html @@ -1,12 +1,19 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block content %} Report for {{report.task.title}} <br /> <hr /> -Description:<br /> +Description: +<br /> + {{ report.data|linebreaksbr }} + <hr /> -Summary: {{ report.summary }} <br /> +Summary: {{ report.summary }} +<br /> <hr /> -Attachment: <a href="{{report.attachment.url}}">{{report.attachment.name}}</a> + +Attachment: <a href="{{report.attachment.url}}">{{report.attachment.name}}</a> + {% endblock %} diff --git a/pytask/templates/task/view_textbook.html b/pytask/templates/task/view_textbook.html index 57895d6..f7e90a8 100644 --- a/pytask/templates/task/view_textbook.html +++ b/pytask/templates/task/view_textbook.html @@ -1,7 +1,9 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block title %} {{textbook.name}} {% endblock %} + {% block content %} <h3>{{ textbook.name }}</h3> @@ -51,12 +53,7 @@ <hr /> {% if can_comment %} - Add comment:<br /> - <form action="" method="post"> - {% csrf_token %} - {{form.as_p}} - <input type="submit" value="Submit"> - </form> + {% as_div_form form "Comment Form" csrf_token "Submit" %} {% endif %} {% endblock %} diff --git a/pytask/templates/task/view_work.html b/pytask/templates/task/view_work.html index 8fbd334..3022397 100644 --- a/pytask/templates/task/view_work.html +++ b/pytask/templates/task/view_work.html @@ -1,23 +1,29 @@ -{% extends 'base.html' %} +{% extends "base.html" %} + {% block title %} - {{task.title}} + {{task.title}} {% endblock %} + {% block content %} -{% if not old_reports %} -There are no reports submitted as of now<br /> -{% else %} -<table > -{% for rep in old_reports %} -<tr> - <td>{{rep.submitted_by}}</td> - <td><a href="{% url view_report rep.id %}">{{rep.data}}</a></td> - <td><a href="{{rep.attachment.url}}">{{rep.attachment.name}}</a> </td> -</tr> -{% endfor %} -</table> -{% endif %} -{% if is_working %} -<a href="{% url submit_report rep.id %}">Submit report</a> -<hr /> -{% endif %} + + {% if not old_reports %} + There are no reports submitted as of now<br /> + {% else %} + + <table > + {% for rep in old_reports %} + <tr> + <td>{{rep.submitted_by}}</td> + <td><a href="{% url view_report rep.id %}">{{rep.data}}</a></td> + <td><a href="{{rep.attachment.url}}">{{rep.attachment.name}}</a> </td> + </tr> + {% endfor %} + </table> + + {% endif %} + + {% if is_working %} + <a href="{% url submit_report rep.id %}">Submit report</a> + <hr /> + {% endif %} {% endblock %} diff --git a/pytask/templates/templatetags/_as_div_form.html b/pytask/templates/templatetags/_as_div_form.html index 2804133..e381dd0 100644 --- a/pytask/templates/templatetags/_as_div_form.html +++ b/pytask/templates/templatetags/_as_div_form.html @@ -1,6 +1,11 @@ {% load form_helpers %} -<form action="{{ action_url }}" method="post"> +<form action="{{ action_url }}" method="post" + {% if file_support %} + enctype="multipart/form-data" + {% else %} + > + {% endif %} {% csrf_token %} <div id="form"> {% for field in form %} diff --git a/pytask/templatetags/form_helpers.py b/pytask/templatetags/form_helpers.py index 6242df2..4e9fa37 100644 --- a/pytask/templatetags/form_helpers.py +++ b/pytask/templatetags/form_helpers.py @@ -14,7 +14,8 @@ register = template.Library() @register.inclusion_tag('templatetags/_as_div_form.html') -def as_div_form(form, form_name, csrf_token, action_url, button_label): +def as_div_form(form, form_name, csrf_token, button_label, + action_url='', file_support=False): """Returns a form to be constructed by the template specified. """ @@ -24,6 +25,7 @@ def as_div_form(form, form_name, csrf_token, action_url, button_label): 'csrf_token': csrf_token, 'action_url': action_url, 'button_label': button_label, + 'file_support': file_support, } |