diff --git a/client/src/pages/learningPath/learningContentPage/LearningContent.vue b/client/src/pages/learningPath/learningContentPage/LearningContent.vue index b4f668ca..fc7f1836 100644 --- a/client/src/pages/learningPath/learningContentPage/LearningContent.vue +++ b/client/src/pages/learningPath/learningContentPage/LearningContent.vue @@ -3,8 +3,10 @@ import LearningContentContainer from "@/pages/learningPath/learningContentPage/L import { useCircleStore } from "@/stores/circle"; import type { LearningContent, LearningContentType } from "@/types"; import log from "loglevel"; +import type { Component } from "vue"; import { computed } from "vue"; +import AttendanceDayBlock from "@/pages/learningPath/learningContentPage/blocks/AttendanceDayBlock.vue"; import DescriptionBlock from "./blocks/DescriptionBlock.vue"; import DescriptionTextBlock from "./blocks/DescriptionTextBlock.vue"; import FeedbackBlock from "./blocks/FeedbackBlock.vue"; @@ -30,8 +32,7 @@ const block = computed(() => { }); // can't use the type as component name, as some are reserved HTML components, e.g. video -const COMPONENTS: Record = { - // todo: can we find a better type here than any? ^ +const COMPONENTS: Record = { placeholder: PlaceholderBlock, video: VideoBlock, assignment: DescriptionTextBlock, @@ -44,6 +45,7 @@ const COMPONENTS: Record = { document: DescriptionBlock, media_library: MediaLibraryBlock, online_training: DescriptionBlock, + attendance_day: AttendanceDayBlock, }; const DEFAULT_BLOCK = DescriptionBlock; diff --git a/client/src/pages/learningPath/learningContentPage/blocks/AttendanceDayBlock.vue b/client/src/pages/learningPath/learningContentPage/blocks/AttendanceDayBlock.vue new file mode 100644 index 00000000..460eabb3 --- /dev/null +++ b/client/src/pages/learningPath/learningContentPage/blocks/AttendanceDayBlock.vue @@ -0,0 +1,27 @@ + + + diff --git a/client/src/types.ts b/client/src/types.ts index b6b0c440..9ef64c9d 100644 --- a/client/src/types.ts +++ b/client/src/types.ts @@ -78,6 +78,10 @@ export interface FeedbackBlock extends BaseLearningContentBlock { readonly type: "feedback"; } +export interface AttendanceDayBlock extends BaseLearningContentBlock { + readonly type: "attendance_day"; +} + export type LearningContentBlock = | AssignmentBlock | BookBlock @@ -90,7 +94,8 @@ export type LearningContentBlock = | VideoBlock | LearningModuleBlock | PlaceholderBlock - | FeedbackBlock; + | FeedbackBlock + | AttendanceDayBlock; export type LearningContentType = LearningContentBlock["type"]; diff --git a/client/src/utils/typeMaps.ts b/client/src/utils/typeMaps.ts index ac666119..c6292fdd 100644 --- a/client/src/utils/typeMaps.ts +++ b/client/src/utils/typeMaps.ts @@ -28,6 +28,8 @@ export function learningContentTypeData(t: LearningContentType): { return { title: "Reflexion", icon: "it-icon-lc-resource" }; case "feedback": return { title: "Feedback", icon: "it-icon-lc-feedback" }; + case "attendance_day": + return { title: "Feedback", icon: "it-icon-lc-exercise" }; case "placeholder": return { title: "In Umsetzung", icon: "it-icon-lc-document" }; } diff --git a/server/vbv_lernwelt/course/management/commands/create_uk_course.py b/server/vbv_lernwelt/course/management/commands/create_uk_course.py index 62264b4b..755dde80 100644 --- a/server/vbv_lernwelt/course/management/commands/create_uk_course.py +++ b/server/vbv_lernwelt/course/management/commands/create_uk_course.py @@ -17,6 +17,7 @@ from vbv_lernwelt.learnpath.tests.learning_path_factories import ( LearningUnitFactory, MediaLibraryBlockFactory, TopicFactory, + AttendanceDayBlockFactory, ) @@ -259,6 +260,17 @@ damit du erfolgreich mit deinem Lernpfad (durch-)starten kannst. title="Unterlagen für den Unterricht", parent=circle, ) + LearningUnitFactory(title="Präsenztag", parent=circle) + LearningContentFactory( + title="Präsenztag Fahrzeug", + parent=circle, + contents=[ + ( + "attendance_day", + AttendanceDayBlockFactory(), + ) + ], + ) LearningUnitFactory(title="Kompetenznachweis", parent=circle) LearningContentFactory( title="Wissens- und Verständnisfragen", diff --git a/server/vbv_lernwelt/learnpath/migrations/0002_alter_learningcontent_contents.py b/server/vbv_lernwelt/learnpath/migrations/0002_alter_learningcontent_contents.py new file mode 100644 index 00000000..ca07f430 --- /dev/null +++ b/server/vbv_lernwelt/learnpath/migrations/0002_alter_learningcontent_contents.py @@ -0,0 +1,20 @@ +# Generated by Django 3.2.13 on 2023-04-03 16:05 + +from django.db import migrations +import wagtail.blocks +import wagtail.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('learnpath', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='learningcontent', + name='contents', + field=wagtail.fields.StreamField([('video', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('resource', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock()), ('text', wagtail.blocks.RichTextBlock(required=False))])), ('exercise', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('learningmodule', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('online_training', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('media_library', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('document', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('test', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('book', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('assignment', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock()), ('text', wagtail.blocks.RichTextBlock(required=False))])), ('placeholder', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())])), ('feedback', wagtail.blocks.StructBlock([])), ('attendance_day', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock())]))], use_json_field=None), + ), + ] diff --git a/server/vbv_lernwelt/learnpath/models.py b/server/vbv_lernwelt/learnpath/models.py index 616cf022..51e57265 100644 --- a/server/vbv_lernwelt/learnpath/models.py +++ b/server/vbv_lernwelt/learnpath/models.py @@ -22,6 +22,7 @@ from vbv_lernwelt.learnpath.models_learning_unit_content import ( ResourceBlock, TestBlock, VideoBlock, + AttendanceDayBlock, ) @@ -248,6 +249,7 @@ class LearningContent(CourseBasePage): ("assignment", AssignmentBlock()), ("placeholder", PlaceholderBlock()), ("feedback", FeedbackBlock()), + ("attendance_day", AttendanceDayBlock()), ] contents = StreamField( diff --git a/server/vbv_lernwelt/learnpath/models_learning_unit_content.py b/server/vbv_lernwelt/learnpath/models_learning_unit_content.py index 9bf81961..ce7351a8 100644 --- a/server/vbv_lernwelt/learnpath/models_learning_unit_content.py +++ b/server/vbv_lernwelt/learnpath/models_learning_unit_content.py @@ -95,3 +95,10 @@ class PlaceholderBlock(blocks.StructBlock): class FeedbackBlock(blocks.StructBlock): class Meta: icon = "media" + + +class AttendanceDayBlock(blocks.StructBlock): + description = blocks.TextBlock() + + class Meta: + icon = "media" diff --git a/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py b/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py index 725cac53..348247c2 100644 --- a/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py +++ b/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py @@ -21,6 +21,7 @@ from vbv_lernwelt.learnpath.models_learning_unit_content import ( ResourceBlock, TestBlock, VideoBlock, + AttendanceDayBlock, ) @@ -125,6 +126,13 @@ class MediaLibraryBlockFactory(wagtail_factories.StructBlockFactory): model = MediaLibraryBlock +class AttendanceDayBlockFactory(wagtail_factories.StructBlockFactory): + description = "Beispiel Präsenztag" + + class Meta: + model = AttendanceDayBlock + + class CircleFactory(wagtail_factories.PageFactory): title = "Basis" description = """