From bea864d967bcf3bb4db4f38cfd888d973892d593 Mon Sep 17 00:00:00 2001 From: Florian Hoss Date: Wed, 6 Apr 2022 14:24:01 +0200 Subject: [PATCH] show tasks in a table --- Lab01/app/.idea/app.iml | 1 + Lab01/app/.idea/jsLibraryMappings.xml | 2 +- Lab01/app/templates/_base.tmpl | 1 + Lab01/app/templates/tasks.tmpl | 15 ++++++++++++--- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Lab01/app/.idea/app.iml b/Lab01/app/.idea/app.iml index c3861b8..3f092d9 100644 --- a/Lab01/app/.idea/app.iml +++ b/Lab01/app/.idea/app.iml @@ -7,5 +7,6 @@ + \ No newline at end of file diff --git a/Lab01/app/.idea/jsLibraryMappings.xml b/Lab01/app/.idea/jsLibraryMappings.xml index f12a793..a9dd937 100644 --- a/Lab01/app/.idea/jsLibraryMappings.xml +++ b/Lab01/app/.idea/jsLibraryMappings.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/Lab01/app/templates/_base.tmpl b/Lab01/app/templates/_base.tmpl index 9a70cf8..92a9cf2 100644 --- a/Lab01/app/templates/_base.tmpl +++ b/Lab01/app/templates/_base.tmpl @@ -8,6 +8,7 @@ + {{end}} {{define "toasts"}} diff --git a/Lab01/app/templates/tasks.tmpl b/Lab01/app/templates/tasks.tmpl index 2baf313..c432522 100644 --- a/Lab01/app/templates/tasks.tmpl +++ b/Lab01/app/templates/tasks.tmpl @@ -8,8 +8,8 @@ {{template "navbar" .}} -
-
{{ .title }}
+
+
{{ .title }}

@@ -21,6 +21,15 @@ function getAllTasks() { axios.get("/tasks", axiosConfig).then((response) => { + const taskHeader = document.createElement("div"); + taskHeader.classList.add('row', 'g-0', 'align-items-center', 'mb-1'); + taskHeader.innerHTML = ` +
ID
+
Description
+
Done
+
+ `; + tasksEl.appendChild(taskHeader); const tasks = response.data.tasks; [...tasks] .forEach((task) => { @@ -29,7 +38,7 @@ newTask.innerHTML = `
${task.ID}
${task.Description}
-
${task.Done}
+
`; tasksEl.appendChild(newTask); });