SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 83923f42 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add tasklist table view

parent 4708fae0
No related branches found
No related tags found
No related merge requests found
......@@ -15,32 +15,55 @@
<div class="d-flex flex-column gap-3">
{% for task_type, tasks in kinds_with_tasks.items %}
<details name="task-type" class="border border-primary border-1 rounded">
<summary class="p-2 bg-primary bg-opacity-10 d-flex justify-content-between align-items-center">
<div>
<h2>{{ task_type.name }}</h2>
<p class="m-0">{{ task_type.description }}</p>
</div>
<div class="d-flex flex-column">
<span class="fs-4">{{ tasks|length }}</span>
</div>
</summary>
<div class="p-3">
<ul class="list-unstyled d-flex flex-column align-items-stretch gap-4 m-0">
{% for task in tasks %}
<li>{{ task.as_html|safe }}</li>
{% empty %}
<li class="text-muted text-center fs-4">No tasks of this type</li>
{% endfor %}
</ul>
</div>
</details>
{% empty %}
<p class="text-muted text-center fs-4">No tasks found</p>
{% endfor %}
<table class="table">
<thead>
<tr>
<th scope="col">Type</th>
<th scope="col">Name</th>
<th scope="col">Due</th>
<th scope="col">Actions</th>
</tr>
</thead>
<tbody>
{% for task_type, tasks in kinds_with_tasks.items %}
{% for task in tasks %}
<tr>
<td>{{ task.kind.name }}</td>
<td>{{ task.title }}</td>
<td>{{ task.due_date }}</td>
<td>
{% for action in task.actions|slice:":2" %}{{ action.as_html|safe }}{% endfor %}
{% if task.actions|length > 2 %}
<div class="btn-group" role="group">
<button class="btn btn-sm btn-light dropdown-toggle"
type="button"
data-bs-toggle="dropdown"
aria-expanded="false">
<span>More</span>
</button>
<ul class="dropdown-menu dropdown-menu-end">
{% for action in task.actions|slice:"2:" %}
<li class="dropdown-item">{{ action.element|safe }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}
......@@ -45,4 +45,10 @@ def tasklist_new_grouped(request):
@login_required
@user_passes_test(is_edadmin_or_active_fellow)
def tasklist_new(request):
return HttpResponse("")
context = {
"kinds_with_tasks": {
task_type: task_type.get_tasks()
for task_type in get_all_task_kinds(request.user)
}
}
return render(request, "tasks/tasklist_new.html", context)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment