Refactor dueDate frontent
This commit is contained in:
parent
279b6c1dd5
commit
2fa17e1204
|
|
@ -4,23 +4,33 @@ import type { DueDate } from "@/types";
|
|||
|
||||
const props = defineProps<{
|
||||
dueDate: DueDate;
|
||||
singleLine?: boolean;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center justify-between py-4">
|
||||
<div
|
||||
class="flex justify-between py-4"
|
||||
:class="{ 'flex-col': props.singleLine, 'items-center': !props.singleLine }"
|
||||
>
|
||||
<div class="space-y-1">
|
||||
<a class="text-bold underline" :href="props.dueDate.url">
|
||||
{{ props.dueDate.title }}
|
||||
</a>
|
||||
<p class="text-small text-gray-900">
|
||||
{{ props.dueDate.learning_content_description }}
|
||||
<span v-if="props.dueDate.description !== ''">:</span>
|
||||
{{ props.dueDate.description }}
|
||||
</p>
|
||||
<div>
|
||||
<a class="text-bold underline" :href="props.dueDate.url">
|
||||
{{ props.dueDate.title }}
|
||||
</a>
|
||||
</div>
|
||||
<div class="text-small text-gray-900">
|
||||
<div v-if="props.dueDate.date_type_translation_key">
|
||||
{{ $t(props.dueDate.assignment_type_translation_key) }}:
|
||||
{{ $t(props.dueDate.date_type_translation_key) }}
|
||||
</div>
|
||||
<div v-else>
|
||||
{{ $t(props.dueDate.assignment_type_translation_key) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<div>
|
||||
{{ formatDate(props.dueDate.start, props.dueDate.end) }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"Alle": "Alle",
|
||||
"Anwesenheit Präsenzkurse": "Anwesenheit Präsenzkurse",
|
||||
"Anwesenheit bestätigen": "Anwesenheit bestätigen",
|
||||
"Anwesenheit prüfen": "Anwesenheit prüfen",
|
||||
|
|
@ -7,6 +8,7 @@
|
|||
"Ergebnisse anschauen": "Ergebnisse anschauen",
|
||||
"Feedback": "Feedback",
|
||||
"Feedback anschauen": "Feedback anschauen",
|
||||
"Feedback: Feedback zum Lehrgang": "Feedback: Feedback zum Lehrgang",
|
||||
"MS Teams öffnen": "MS Teams öffnen",
|
||||
"Nächste Termine": "Nächste Termine",
|
||||
"Passwort": "Passwort",
|
||||
|
|
@ -22,8 +24,8 @@
|
|||
"assignmentSubmitted": "Du hast deine Ergebnisse erfolgreich abgegeben.",
|
||||
"confirmSubmitPerson": "Hiermit bestätige ich, dass die folgende Person meine Ergebnisse bewerten soll.",
|
||||
"confirmSubmitResults": "Hiermit bestätige ich, dass ich die Zusammenfassung meiner Ergebnisse überprüft habe und so abgeben will.",
|
||||
"dueDateEvaluation": "assignment.dueDateEvaluation",
|
||||
"dueDateIntroduction": "Reiche deine Ergebnisse pünktlich ein bis am: ",
|
||||
"dueDateEvaluation": "Freigabetermin Bewertung",
|
||||
"dueDateNotSet": "Keine Abgabedaten wurden erfasst für diese Durchführung",
|
||||
"dueDateSubmission": "Abgabetermin",
|
||||
"edit": "Bearbeiten",
|
||||
|
|
@ -107,7 +109,7 @@
|
|||
"showAllDueDates": "Alle Termine anzeigen"
|
||||
},
|
||||
"edoniqTest": {
|
||||
"qualifiesForExtendedTime": "Ich habe Anrecht auf einen Nachteilsausgleich."
|
||||
"qualifiesForExtendedTime": "edoniqTest.qualifiesForExtendedTime"
|
||||
},
|
||||
"feedback": {
|
||||
"answers": "Antworten",
|
||||
|
|
@ -272,7 +274,7 @@
|
|||
"selfEvaluationNo": "@:selfEvaluation: Muss ich nochmals anschauen.",
|
||||
"selfEvaluationYes": "@:selfEvaluation: Ich kann das.",
|
||||
"steps": "Schritt {{current}} von {{max}}",
|
||||
"title": "Selbsteinschätzung {{title}}",
|
||||
"title": "@:selfEvaluation.selfEvaluation {{title}}",
|
||||
"yes": "Ja, ich kann das"
|
||||
},
|
||||
"settings": {
|
||||
|
|
|
|||
|
|
@ -1,22 +1,9 @@
|
|||
<script setup lang="ts">
|
||||
import { useCurrentCourseSession } from "@/composables";
|
||||
import type { Dayjs } from "dayjs";
|
||||
import type { DueDate } from "@/types";
|
||||
import DueDateSingle from "@/components/dueDates/DueDateSingle.vue";
|
||||
|
||||
const courseSession = useCurrentCourseSession();
|
||||
const dueDates = courseSession.value.due_dates.slice(0, 2);
|
||||
|
||||
const formatDate = (date: Dayjs) => {
|
||||
return date.format("DD.MM.YYYY");
|
||||
};
|
||||
|
||||
const formatDateLine = (dueDate: DueDate) => {
|
||||
let line = `${formatDate(dueDate.start)} - ${dueDate.learning_content_description}`;
|
||||
if (dueDate.description.length !== 0) {
|
||||
line += `: ${dueDate.description}`;
|
||||
}
|
||||
return line;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
|
@ -27,7 +14,7 @@ const formatDateLine = (dueDate: DueDate) => {
|
|||
:key="dueDate.id"
|
||||
class="border-t border-gray-500 pt-2"
|
||||
>
|
||||
{{ formatDateLine(dueDate) }}
|
||||
<DueDateSingle :due-date="dueDate" :single-line="true"></DueDateSingle>
|
||||
</div>
|
||||
<div v-if="dueDates.length === 0">{{ $t("dueDates.noDueDatesAvailable") }}</div>
|
||||
<a class="border-t border-gray-500 pt-8 underline" href="">
|
||||
|
|
|
|||
|
|
@ -575,8 +575,9 @@ export type DueDate = {
|
|||
start: Dayjs;
|
||||
end: Dayjs;
|
||||
title: string;
|
||||
learning_content_description: string;
|
||||
description: string;
|
||||
assignment_type_translation_key: string;
|
||||
date_type_translation_key: string;
|
||||
subtitle: string;
|
||||
url: string;
|
||||
course_session: number | null;
|
||||
page: number | null;
|
||||
|
|
|
|||
|
|
@ -1,25 +1,158 @@
|
|||
# Generated by Django 3.2.20 on 2023-08-23 09:27
|
||||
|
||||
from django.db import migrations
|
||||
import wagtail.blocks
|
||||
import wagtail.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('assignment', '0005_alter_assignment_assignment_type'),
|
||||
("assignment", "0005_alter_assignment_assignment_type"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='assignment',
|
||||
name='evaluation_tasks',
|
||||
field=wagtail.fields.StreamField([('task', wagtail.blocks.StructBlock([('title', wagtail.blocks.TextBlock()), ('description', wagtail.blocks.RichTextBlock(blank=True, features=['ul', 'bold', 'italic', 'link'], required=False)), ('max_points', wagtail.blocks.IntegerBlock()), ('sub_tasks', wagtail.blocks.ListBlock(wagtail.blocks.StructBlock([('title', wagtail.blocks.TextBlock()), ('description', wagtail.blocks.RichTextBlock(blank=True, features=['ul', 'bold', 'italic', 'link'], required=False)), ('points', wagtail.blocks.IntegerBlock())]), blank=True, use_json_field=True))]))], blank=True, help_text='Beurteilungsschritte', use_json_field=True),
|
||||
model_name="assignment",
|
||||
name="evaluation_tasks",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
(
|
||||
"task",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("title", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"description",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
blank=True,
|
||||
features=["ul", "bold", "italic", "link"],
|
||||
required=False,
|
||||
),
|
||||
),
|
||||
("max_points", wagtail.blocks.IntegerBlock()),
|
||||
(
|
||||
"sub_tasks",
|
||||
wagtail.blocks.ListBlock(
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("title", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"description",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
blank=True,
|
||||
features=[
|
||||
"ul",
|
||||
"bold",
|
||||
"italic",
|
||||
"link",
|
||||
],
|
||||
required=False,
|
||||
),
|
||||
),
|
||||
(
|
||||
"points",
|
||||
wagtail.blocks.IntegerBlock(),
|
||||
),
|
||||
]
|
||||
),
|
||||
blank=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
)
|
||||
],
|
||||
blank=True,
|
||||
help_text="Beurteilungsschritte",
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='assignment',
|
||||
name='tasks',
|
||||
field=wagtail.fields.StreamField([('task', wagtail.blocks.StructBlock([('title', wagtail.blocks.TextBlock()), ('file_submission_required', wagtail.blocks.BooleanBlock(required=False)), ('content', wagtail.blocks.StreamBlock([('explanation', wagtail.blocks.StructBlock([('text', wagtail.blocks.RichTextBlock(features=['ul', 'bold', 'italic', 'link']))])), ('user_text_input', wagtail.blocks.StructBlock([('text', wagtail.blocks.RichTextBlock(blank=True, features=['ul', 'bold', 'italic', 'link'], required=False))])), ('user_confirmation', wagtail.blocks.StructBlock([('text', wagtail.blocks.RichTextBlock(features=['ul', 'bold', 'italic', 'link']))]))], blank=True))]))], blank=True, help_text='Teilaufgaben', use_json_field=True),
|
||||
model_name="assignment",
|
||||
name="tasks",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
(
|
||||
"task",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("title", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"file_submission_required",
|
||||
wagtail.blocks.BooleanBlock(required=False),
|
||||
),
|
||||
(
|
||||
"content",
|
||||
wagtail.blocks.StreamBlock(
|
||||
[
|
||||
(
|
||||
"explanation",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"text",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
features=[
|
||||
"ul",
|
||||
"bold",
|
||||
"italic",
|
||||
"link",
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"user_text_input",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"text",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
blank=True,
|
||||
features=[
|
||||
"ul",
|
||||
"bold",
|
||||
"italic",
|
||||
"link",
|
||||
],
|
||||
required=False,
|
||||
),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"user_confirmation",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
(
|
||||
"text",
|
||||
wagtail.blocks.RichTextBlock(
|
||||
features=[
|
||||
"ul",
|
||||
"bold",
|
||||
"italic",
|
||||
"link",
|
||||
]
|
||||
),
|
||||
)
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
blank=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
)
|
||||
],
|
||||
blank=True,
|
||||
help_text="Teilaufgaben",
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -4,62 +4,91 @@ from django.db import migrations, models
|
|||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('duedate', '0002_alter_duedate_start'),
|
||||
("duedate", "0002_alter_duedate_start"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='duedate',
|
||||
options={'ordering': ['start', 'end']},
|
||||
name="duedate",
|
||||
options={"ordering": ["start", "end"]},
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='duedate',
|
||||
name='description',
|
||||
model_name="duedate",
|
||||
name="description",
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='duedate',
|
||||
name='learning_content_description',
|
||||
model_name="duedate",
|
||||
name="learning_content_description",
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='duedate',
|
||||
name='assignment_type_translation_key',
|
||||
field=models.CharField(blank=True, default='', help_text='Translation Key aus dem Frontend', max_length=1024),
|
||||
model_name="duedate",
|
||||
name="assignment_type_translation_key",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
default="",
|
||||
help_text="Translation Key aus dem Frontend",
|
||||
max_length=1024,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='duedate',
|
||||
name='date_type_translation_key',
|
||||
field=models.CharField(blank=True, default='', help_text='Translation Key aus dem Frontend', max_length=1024),
|
||||
model_name="duedate",
|
||||
name="date_type_translation_key",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
default="",
|
||||
help_text="Translation Key aus dem Frontend",
|
||||
max_length=1024,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='duedate',
|
||||
name='manual_override_fields',
|
||||
field=models.BooleanField(default=False, help_text='Nur aktivieren, wenn man die Felder manuell überschreiben will'),
|
||||
model_name="duedate",
|
||||
name="manual_override_fields",
|
||||
field=models.BooleanField(
|
||||
default=False,
|
||||
help_text="Nur aktivieren, wenn man die Felder manuell überschreiben will",
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='duedate',
|
||||
name='subtitle',
|
||||
field=models.TextField(blank=True, default='', help_text='Überschreibt den Untertitel bei `assignment_type_translation_key` und `date_type_translation_key`'),
|
||||
model_name="duedate",
|
||||
name="subtitle",
|
||||
field=models.TextField(
|
||||
blank=True,
|
||||
default="",
|
||||
help_text="Überschreibt den Untertitel bei `assignment_type_translation_key` und `date_type_translation_key`",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='duedate',
|
||||
name='end',
|
||||
field=models.DateTimeField(blank=True, db_index=True, help_text='Enddatum ist optional', null=True),
|
||||
model_name="duedate",
|
||||
name="end",
|
||||
field=models.DateTimeField(
|
||||
blank=True, db_index=True, help_text="Enddatum ist optional", null=True
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='duedate',
|
||||
name='start',
|
||||
field=models.DateTimeField(blank=True, db_index=True, help_text='Startdatum ist Pflicht', null=True),
|
||||
model_name="duedate",
|
||||
name="start",
|
||||
field=models.DateTimeField(
|
||||
blank=True, db_index=True, help_text="Startdatum ist Pflicht", null=True
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='duedate',
|
||||
name='title',
|
||||
field=models.CharField(default='', help_text='Title wird standarmässig vom LearningContent übernommen', max_length=1024),
|
||||
model_name="duedate",
|
||||
name="title",
|
||||
field=models.CharField(
|
||||
default="",
|
||||
help_text="Title wird standarmässig vom LearningContent übernommen",
|
||||
max_length=1024,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='duedate',
|
||||
name='url',
|
||||
field=models.CharField(blank=True, default='', help_text='URL wird vom LearningContent übernommen', max_length=1024),
|
||||
model_name="duedate",
|
||||
name="url",
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
default="",
|
||||
help_text="URL wird vom LearningContent übernommen",
|
||||
max_length=1024,
|
||||
),
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import datetime
|
|||
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from wagtail.models import Page
|
||||
|
||||
from vbv_lernwelt.core.models import User
|
||||
|
|
|
|||
Loading…
Reference in New Issue