Don't show table unless there are items to show
This commit is contained in:
parent
b361abeaf6
commit
982864e1ba
2 changed files with 59 additions and 57 deletions
|
@ -34,64 +34,68 @@
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if list_slug == "mine" %}
|
{% if items %}
|
||||||
|
{% if list_slug == "mine" %}
|
||||||
<h1>Tasks assigned to me (in all groups)</h1>
|
<h1>Tasks assigned to me (in all groups)</h1>
|
||||||
{% else %}
|
{% else %}
|
||||||
<h1>Tasks filed under "{{ task_list.name }}"</h1>
|
<h1>Tasks filed under "{{ task_list.name }}"</h1>
|
||||||
<p>This list belongs to group {{ task_list.group }}</p>
|
<p>This list belongs to group {{ task_list.group }}</p>
|
||||||
<h3>Tasks :: Drag rows to set priorities</h3>
|
<h3>Tasks :: Drag rows to set priorities</h3>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<form action="" name="show_tasks" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<table class="table" id="tasktable">
|
||||||
|
<tr>
|
||||||
|
<th>Done</th>
|
||||||
|
<th>Task</th>
|
||||||
|
<th>Created</th>
|
||||||
|
<th>Due on</th>
|
||||||
|
<th>Owner</th>
|
||||||
|
<th>Assigned</th>
|
||||||
|
<th>Note</th>
|
||||||
|
<th>Comm</th>
|
||||||
|
<th>Del</th>
|
||||||
|
</tr>
|
||||||
|
{% for task in items %}
|
||||||
|
<tr id="{{ task.id }}">
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" name="toggle_done_tasks" value="{{ task.id }}" id="{{ task.id }}">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{% url 'todo:task_detail' task.id %}">{{ task.title|truncatewords:20 }}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ task.created_date|date:"m/d/Y" }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span {% if task.overdue_status %}class="overdue"{% endif %}>
|
||||||
|
{{ task.due_date|date:"m/d/Y" }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ task.created_by }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if task.assigned_to %}{{ task.assigned_to }}{% else %}Anyone{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if task.note %}≈{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% if task.comment_set.all.count > 0 %}{{ task.comment_set.all.count }}{% endif %}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<input type="checkbox" name="toggle_deleted_tasks" value="{{ task.id }}" id="{{ task.id }}">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
<p><input type="submit" name="process_tasks" value="Continue..." class="todo-button"></p>
|
||||||
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<h4>No items on this list yet (add one!)</h4>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<form action="" name="show_tasks" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
<table class="table" id="tasktable">
|
|
||||||
<tr>
|
|
||||||
<th>Done</th>
|
|
||||||
<th>Task</th>
|
|
||||||
<th>Created</th>
|
|
||||||
<th>Due on</th>
|
|
||||||
<th>Owner</th>
|
|
||||||
<th>Assigned</th>
|
|
||||||
<th>Note</th>
|
|
||||||
<th>Comm</th>
|
|
||||||
<th>Del</th>
|
|
||||||
</tr>
|
|
||||||
{% for task in items %}
|
|
||||||
<tr id="{{ task.id }}">
|
|
||||||
<td>
|
|
||||||
<input type="checkbox" name="toggle_done_tasks" value="{{ task.id }}" id="{{ task.id }}">
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="{% url 'todo:task_detail' task.id %}">{{ task.title|truncatewords:20 }}</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ task.created_date|date:"m/d/Y" }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span {% if task.overdue_status %}class="overdue"{% endif %}>
|
|
||||||
{{ task.due_date|date:"m/d/Y" }}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{{ task.created_by }}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% if task.assigned_to %}{{ task.assigned_to }}{% else %}Anyone{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% if task.note %}≈{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{% if task.comment_set.all.count > 0 %}{{ task.comment_set.all.count }}{% endif %}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<input type="checkbox" name="toggle_deleted_tasks" value="{{ task.id }}" id="{{ task.id }}">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
<p><input type="submit" name="process_tasks" value="Continue..." class="todo-button"></p>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
{% if list_slug != "mine" %}
|
{% if list_slug != "mine" %}
|
||||||
{% if view_completed %}
|
{% if view_completed %}
|
||||||
|
@ -103,7 +107,6 @@
|
||||||
<p><a class="todo" href="{% url 'todo:del_list' list_id list_slug %}">Delete this list</a></p>
|
<p><a class="todo" href="{% url 'todo:del_list' list_id list_slug %}">Delete this list</a></p>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
@ -136,4 +139,4 @@
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endblock extra_js %}
|
{% endblock extra_js %}
|
||||||
|
|
|
@ -22,7 +22,7 @@ from todo.utils import toggle_done, toggle_deleted, send_notify_mail
|
||||||
def check_user_allowed(user):
|
def check_user_allowed(user):
|
||||||
"""
|
"""
|
||||||
Verifies user is logged in, and in staff if that setting is enabled.
|
Verifies user is logged in, and in staff if that setting is enabled.
|
||||||
Per-object permission checks (e.g. to view a particular list) must be in the views that handle those objects.
|
Per-object permission checks (e.g. to view a particular list) are in the views that handle those objects.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if settings.STAFF_ONLY:
|
if settings.STAFF_ONLY:
|
||||||
|
@ -106,7 +106,6 @@ def list_detail(request, list_id=None, list_slug=None, view_completed=False):
|
||||||
task_list = get_object_or_404(TaskList, id=list_id)
|
task_list = get_object_or_404(TaskList, id=list_id)
|
||||||
items = Item.objects.filter(task_list=task_list.id)
|
items = Item.objects.filter(task_list=task_list.id)
|
||||||
|
|
||||||
# Apply filters to base queryset
|
|
||||||
if view_completed:
|
if view_completed:
|
||||||
items = items.filter(completed=True)
|
items = items.filter(completed=True)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue