diff --git a/client/src/pages/learningPath/learningContentPage/LearningContentParent.vue b/client/src/pages/learningPath/learningContentPage/LearningContentParent.vue index 5d5cb0ee..554d165d 100644 --- a/client/src/pages/learningPath/learningContentPage/LearningContentParent.vue +++ b/client/src/pages/learningPath/learningContentPage/LearningContentParent.vue @@ -1,6 +1,7 @@ + + diff --git a/client/src/types.ts b/client/src/types.ts index 5a1a0fb7..9e25f7d1 100644 --- a/client/src/types.ts +++ b/client/src/types.ts @@ -85,11 +85,12 @@ export interface LearningContentPlaceholder extends LearningContentInterface { export interface LearningContentRichText extends LearningContentInterface { readonly content_type: "learnpath.LearningContentRichText"; - text: string; + readonly text: string; } export interface LearningContentTest extends LearningContentInterface { readonly content_type: "learnpath.LearningContentTest"; + readonly checkbox_text: string; } export interface LearningContentVideo extends LearningContentInterface { diff --git a/client/src/utils/typeMaps.ts b/client/src/utils/typeMaps.ts index 96d8bb34..dbe01f63 100644 --- a/client/src/utils/typeMaps.ts +++ b/client/src/utils/typeMaps.ts @@ -44,5 +44,7 @@ export function learningContentTypeData( return { title: "In Umsetzung", icon: "it-icon-lc-document" }; } + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore return assertUnreachable(`did not handle ${lc.content_type}`); } diff --git a/server/vbv_lernwelt/course/creators/uk_course.py b/server/vbv_lernwelt/course/creators/uk_course.py index 283778e4..3cc0c495 100644 --- a/server/vbv_lernwelt/course/creators/uk_course.py +++ b/server/vbv_lernwelt/course/creators/uk_course.py @@ -14,14 +14,15 @@ from vbv_lernwelt.learnpath.tests.learning_path_factories import ( CircleFactory, LearningContentAssignmentFactory, LearningContentAttendanceCourseFactory, + LearningContentDocumentListFactory, LearningContentFeedbackFactory, LearningContentMediaLibraryFactory, LearningContentPlaceholderFactory, + LearningContentTestFactory, LearningPathFactory, LearningSequenceFactory, LearningUnitFactory, TopicFactory, - LearningContentDocumentListFactory, ) @@ -226,7 +227,7 @@ In diesem Circle erfährst du wie die überbetrieblichen Kurse aufgebaut sind. Z ) LearningUnitFactory(title="Vorbereitung", parent=circle) LearningContentMediaLibraryFactory( - title=f"Handlungsfeld «{title}»", + title=f"Allgemeines zu Versicherungen", parent=circle, description=RichText( f"

In der Mediathek unter dem Handlungsfeld «{title}» findest du alle relevanten Ressourcen für deine Fachkompetenzen.

" @@ -298,9 +299,14 @@ In diesem Circle lernst du die wichtigsten Grundlagen bezüglich Versicherungswi parent=circle, ) LearningUnitFactory(title="Kompetenznachweis", parent=circle) - LearningContentPlaceholderFactory( + LearningContentTestFactory( title="Wissens- und Verständnisfragen", parent=circle, + description=RichText( + "

Folgender Test mit Wissens- und Verständnisfragen ist Teil des Kompetenznachweises. Der Test kann nur einmal durchgeführt werden und ist notenrelevant.

" + ), + checkbox_text="Hiermit bestätige ich, dass ich die Anweisungen verstanden habe und den Test durchführen möchte.", + content_url="http://example.com", ) LearningContentFeedbackFactory( parent=circle, diff --git a/server/vbv_lernwelt/learnpath/migrations/0005_learningcontentdocumentlist.py b/server/vbv_lernwelt/learnpath/migrations/0005_learningcontentdocumentlist.py index 0bf83528..406cfc8c 100644 --- a/server/vbv_lernwelt/learnpath/migrations/0005_learningcontentdocumentlist.py +++ b/server/vbv_lernwelt/learnpath/migrations/0005_learningcontentdocumentlist.py @@ -1,31 +1,85 @@ # Generated by Django 3.2.13 on 2023-05-26 10:34 -from django.db import migrations, models import django.db.models.deletion import wagtail.blocks import wagtail.fields +from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('wagtailcore', '0083_workflowcontenttype'), - ('learnpath', '0004_learningcontentassignment_assignment_type'), + ("wagtailcore", "0083_workflowcontenttype"), + ("learnpath", "0004_learningcontentassignment_assignment_type"), ] operations = [ migrations.CreateModel( - name='LearningContentDocumentList', + name="LearningContentDocumentList", fields=[ - ('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')), - ('minutes', models.PositiveIntegerField(default=15)), - ('description', wagtail.fields.RichTextField(blank=True)), - ('content_url', models.TextField(blank=True)), - ('documents', wagtail.fields.StreamField([('document', wagtail.blocks.StructBlock([('title', wagtail.blocks.TextBlock()), ('description', wagtail.blocks.TextBlock(default='', required=False)), ('icon_url', wagtail.blocks.TextBlock(default='', required=False)), ('link_display_text', wagtail.blocks.CharBlock(default='Link öffnen', max_length=255)), ('url', wagtail.blocks.TextBlock(default='', required=False)), ('open_window', wagtail.blocks.BooleanBlock(default=False))]))], blank=True, use_json_field=True)), + ( + "page_ptr", + models.OneToOneField( + auto_created=True, + on_delete=django.db.models.deletion.CASCADE, + parent_link=True, + primary_key=True, + serialize=False, + to="wagtailcore.page", + ), + ), + ("minutes", models.PositiveIntegerField(default=15)), + ("description", wagtail.fields.RichTextField(blank=True)), + ("content_url", models.TextField(blank=True)), + ( + "documents", + wagtail.fields.StreamField( + [ + ( + "document", + wagtail.blocks.StructBlock( + [ + ("title", wagtail.blocks.TextBlock()), + ( + "description", + wagtail.blocks.TextBlock( + default="", required=False + ), + ), + ( + "icon_url", + wagtail.blocks.TextBlock( + default="", required=False + ), + ), + ( + "link_display_text", + wagtail.blocks.CharBlock( + default="Link öffnen", max_length=255 + ), + ), + ( + "url", + wagtail.blocks.TextBlock( + default="", required=False + ), + ), + ( + "open_window", + wagtail.blocks.BooleanBlock(default=False), + ), + ] + ), + ) + ], + blank=True, + use_json_field=True, + ), + ), ], options={ - 'abstract': False, + "abstract": False, }, - bases=('wagtailcore.page',), + bases=("wagtailcore.page",), ), ] diff --git a/server/vbv_lernwelt/learnpath/migrations/0006_learningcontenttest_checkbox_text.py b/server/vbv_lernwelt/learnpath/migrations/0006_learningcontenttest_checkbox_text.py new file mode 100644 index 00000000..545416ae --- /dev/null +++ b/server/vbv_lernwelt/learnpath/migrations/0006_learningcontenttest_checkbox_text.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.13 on 2023-05-26 14:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("learnpath", "0005_learningcontentdocumentlist"), + ] + + operations = [ + migrations.AddField( + model_name="learningcontenttest", + name="checkbox_text", + field=models.TextField(blank=True), + ), + ] diff --git a/server/vbv_lernwelt/learnpath/models.py b/server/vbv_lernwelt/learnpath/models.py index a430457f..24d6e6cb 100644 --- a/server/vbv_lernwelt/learnpath/models.py +++ b/server/vbv_lernwelt/learnpath/models.py @@ -307,9 +307,18 @@ class LearningContentMediaLibrary(LearningContent): class LearningContentTest(LearningContent): + serialize_field_names = LearningContent.serialize_field_names + [ + "checkbox_text", + ] parent_page_types = ["learnpath.Circle"] subpage_types = [] + checkbox_text = models.TextField(blank=True) + + content_panels = LearningContent.content_panels + [ + FieldPanel("checkbox_text", classname="Text"), + ] + class LearningContentRichText(LearningContent): text = RichTextField(blank=True, features=DEFAULT_RICH_TEXT_FEATURES_WITH_HEADER) diff --git a/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py b/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py index f5428bfd..c1d5be7c 100644 --- a/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py +++ b/server/vbv_lernwelt/learnpath/tests/learning_path_factories.py @@ -5,6 +5,7 @@ from vbv_lernwelt.learnpath.models import ( Circle, LearningContentAssignment, LearningContentAttendanceCourse, + LearningContentDocumentList, LearningContentFeedback, LearningContentLearningModule, LearningContentMediaLibrary, @@ -16,7 +17,6 @@ from vbv_lernwelt.learnpath.models import ( LearningSequence, LearningUnit, Topic, - LearningContentDocumentList, ) from vbv_lernwelt.media_library.tests.media_library_factories import ( LearnMediaBlockFactory,