From f518e98aba9dd6820c992d6900530871be596cdb Mon Sep 17 00:00:00 2001 From: Patrick Mayr Date: Sat, 19 Mar 2022 21:08:10 +0000 Subject: [PATCH] add tasks redesign --- fet2020/tasks/views.py | 18 +- .../templates/tasks/attachment_create.html | 43 ++-- fet2020/templates/tasks/index.html | 199 ++++++++++-------- fet2020/templates/tasks/task_create.html | 69 ++++-- fet2020/templates/tasks/task_detail.html | 82 ++++---- fet2020/templates/tasks/task_update.html | 50 +++-- 6 files changed, 259 insertions(+), 202 deletions(-) diff --git a/fet2020/tasks/views.py b/fet2020/tasks/views.py index b4ce7acf..2896b9a4 100644 --- a/fet2020/tasks/views.py +++ b/fet2020/tasks/views.py @@ -51,11 +51,11 @@ def index(request): else: show_all_tasks = False - if "btn_state" in request.GET: - if request.GET["btn_state"] == "open": - completed = False - elif request.GET["btn_state"] == "close": - completed = True + if "open_tasks" in request.GET: + completed = False + + if "closed_tasks" in request.GET: + completed = True tasks = Task.taskmanager.get_tasks( user=request.user.id, @@ -65,12 +65,6 @@ def index(request): ) tasklists = TaskList.objects.all() - # TODO: very bad solution... try to do it better! - if completed == False: - completed = "open" - else: - completed = "close" - context = { "tasks": tasks, "tasklists": tasklists, @@ -183,7 +177,7 @@ class TaskDetail(LoginRequiredMixin, DetailView): class DocumentCreate(LoginRequiredMixin, CreateView): model = Document - template_name = "tasks/docu_create.html" + template_name = "tasks/attachment_create.html" form_class = DocumentCreateForm task_id = None diff --git a/fet2020/templates/tasks/attachment_create.html b/fet2020/templates/tasks/attachment_create.html index 447b9270..959ac037 100644 --- a/fet2020/templates/tasks/attachment_create.html +++ b/fet2020/templates/tasks/attachment_create.html @@ -1,24 +1,27 @@ -{% extends 'layout.html' %} +{% extends 'base.html' %} + {% block content %} - -
-
-
- Zurück -
-
-
- -

Neues Etherpad hinzufügen

-
-
-
+ +
+

Etherpad hinzufügen

+
+ {% csrf_token %} - {{ form }} - - -
-
-
+ + + + + + + + +
+ {% endblock %} diff --git a/fet2020/templates/tasks/index.html b/fet2020/templates/tasks/index.html index 4a8c23c5..05032e63 100644 --- a/fet2020/templates/tasks/index.html +++ b/fet2020/templates/tasks/index.html @@ -1,92 +1,121 @@ -{% extends 'layout.html' %} +{% extends 'base.html' %} {% block content %} -
- -
- -
-
-
- - -
- -
- - -
- -
- -
- -
- -
-
- -
-
-
- -
- - {% if tasks %} -
- {% csrf_token %} - -
- {% regroup tasks by task_list as section_list %} - {% for group in section_list %} - -
-
    -

    {{ group.grouper }}

    - - {% for task in group.list %} -
    - - -
    - {% if task.due_date %} - Fällig bis: {{ task.due_date|date:"d.m.Y" }} - {% endif %} -
    -
    - {% endfor %} -
+ +
+

Tasks

+
+ + +
+ {% if tasks %} +
+ {% csrf_token %} + {% regroup tasks by task_list as section_list %} + {% for group in section_list %} +

{{ group.grouper }}

+ + {% for task in group.list %} + + {% endfor %} + + + {% endfor %} +
+ {% else %} keine Tasks in dieser Liste für dich. -
-
- {% endif %} -
+ + + {% endif %} + +
+ {% endblock %} diff --git a/fet2020/templates/tasks/task_create.html b/fet2020/templates/tasks/task_create.html index 68ead194..19ae706a 100644 --- a/fet2020/templates/tasks/task_create.html +++ b/fet2020/templates/tasks/task_create.html @@ -1,26 +1,53 @@ -{% extends 'layout.html' %} +{% extends 'base.html' %} {% block content %} -
- -
- -

Neuen Task hinzufügen

-
-
-
+ +
+

Task hinzufügen

+
+ {% csrf_token %} - {{ form }} - - -
+ + + + + + + + + Task-Gruppe erstellen
-
+ {% endblock %} diff --git a/fet2020/templates/tasks/task_detail.html b/fet2020/templates/tasks/task_detail.html index c40b3961..e3910eef 100644 --- a/fet2020/templates/tasks/task_detail.html +++ b/fet2020/templates/tasks/task_detail.html @@ -1,52 +1,48 @@ -{% extends 'layout.html' %} +{% extends 'base.html' %} {% block content %} -
-
-
- Zurück -
- {% if topic %} -
- Zu {{ topic.title }} + +
+

Task-Detailansicht

+
+ + {% if task.note %} +
+ {{ task.note }}
{% endif %} - - -
-
-
-
-

{{ task.title }}

+ {% if task.due_date %} +
+ {{ task.due_date }} +
+ {% endif %} -

Fällig am: {{ task.due_date }}

- - {% if task.completed %} -

Erledigt am: {{ task.completed_date }}

- {% endif %} - - {% if task.note %} - {{ task.note }} - {% endif %} - - {% for document in documents %} - -
-
-

{{ document.title }}

-
-
-

{{ document.date }}

-
-
+
+ + + {% for document in documents %} + +

{{ document.title }}

+ {{ document.date }} +
+ {% endfor %} + +
+ + + {% if topic %} + Zu {{ topic.title }} + {% endif %} + + Task bearbeiten
-
+ {% endblock %} diff --git a/fet2020/templates/tasks/task_update.html b/fet2020/templates/tasks/task_update.html index 1b1c9dbc..bdbd451d 100644 --- a/fet2020/templates/tasks/task_update.html +++ b/fet2020/templates/tasks/task_update.html @@ -1,26 +1,34 @@ -{% extends 'layout.html' %} +{% extends 'base.html' %} {% block content %} -
- -
- -

Task '{{ task.title }}' bearbeiten

-
-
-
+ +
+

Task '{{ task.title }}' bearbeiten

+
+ {% csrf_token %} - {{ form }} - - -
+ + + + + + + + Task im Admin bearbeiten
-
+ {% endblock %}