Anpassung "Verankerung im Lernpfad"
This commit is contained in:
parent
914223bc77
commit
df6f331811
|
|
@ -99,6 +99,7 @@ const learningSequenceBorderClass = computed(() => {
|
|||
>
|
||||
<div
|
||||
v-for="learningUnit in learningSequence.learningUnits"
|
||||
:id="learningUnit.slug"
|
||||
:key="learningUnit.id"
|
||||
class="pt-3 lg:pt-6"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -40,13 +40,25 @@ onMounted(async () => {
|
|||
try {
|
||||
await circleStore.loadCircle(props.learningPathSlug, props.circleSlug);
|
||||
|
||||
if (route.hash.startsWith("#ls-")) {
|
||||
const hashLearningSequence = circleStore.circle?.learningSequences.find((ls) => {
|
||||
return ls.slug.endsWith(route.hash.replace("#", ""));
|
||||
});
|
||||
if (hashLearningSequence) {
|
||||
if (route.hash.startsWith("#ls-") || route.hash.startsWith("#lu-")) {
|
||||
const slugEnd = route.hash.replace("#", "");
|
||||
let wagtailPage = null;
|
||||
|
||||
if (slugEnd.startsWith("ls-")) {
|
||||
wagtailPage = circleStore.circle?.learningSequences.find((ls) => {
|
||||
return ls.slug.endsWith(slugEnd);
|
||||
});
|
||||
} else if (slugEnd.startsWith("lu-")) {
|
||||
const learningUnits = circleStore.circle?.learningSequences.flatMap(
|
||||
(ls) => ls.learningUnits
|
||||
);
|
||||
wagtailPage = learningUnits.find((lu) => {
|
||||
return lu.slug.endsWith(slugEnd);
|
||||
});
|
||||
}
|
||||
if (wagtailPage) {
|
||||
document
|
||||
.getElementById(hashLearningSequence.slug)
|
||||
.getElementById(wagtailPage.slug)
|
||||
?.scrollIntoView({ behavior: "smooth" });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,6 +89,9 @@ const hasMoreItemsForType = (itemType: string, items: object[]) => {
|
|||
>
|
||||
<section v-if="content_collection.value?.contents?.length" class="mb-20">
|
||||
<h2 class="mb-4">{{ content_collection.value.title }}</h2>
|
||||
<p class="mb-4 lg:w-2/3">
|
||||
{{ content_collection.value.description }}
|
||||
</p>
|
||||
<ul
|
||||
:class="{
|
||||
'grid gap-4 grid-cols-1 lg:grid-cols-2': displayAsCard(
|
||||
|
|
|
|||
|
|
@ -1,20 +1,114 @@
|
|||
# Generated by Django 3.2.13 on 2022-10-05 10:06
|
||||
|
||||
from django.db import migrations
|
||||
import wagtail.blocks
|
||||
import wagtail.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('learnpath', '0002_alter_learningcontent_contents'),
|
||||
("learnpath", "0002_alter_learningcontent_contents"),
|
||||
]
|
||||
|
||||
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())])), ('exercise', 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())])), ('placeholder', wagtail.blocks.StructBlock([('description', wagtail.blocks.TextBlock()), ('url', wagtail.blocks.TextBlock())]))], use_json_field=None),
|
||||
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()),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"exercise",
|
||||
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()),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"placeholder",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("description", wagtail.blocks.TextBlock()),
|
||||
("url", wagtail.blocks.TextBlock()),
|
||||
]
|
||||
),
|
||||
),
|
||||
],
|
||||
use_json_field=None,
|
||||
),
|
||||
),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ from wagtail import blocks
|
|||
|
||||
|
||||
class MediaLibraryContentBlock(blocks.StructBlock):
|
||||
title = blocks.TextBlock(blank=False, null=False)
|
||||
title = blocks.TextBlock()
|
||||
description = blocks.TextBlock(default="", required=False)
|
||||
icon_url = blocks.TextBlock(default="", required=False)
|
||||
link_display_text = blocks.CharBlock(max_length=255, default="Link öffnen")
|
||||
|
|
@ -35,6 +35,7 @@ class MediaContentCollection(blocks.StructBlock):
|
|||
"""
|
||||
|
||||
title = blocks.TextBlock()
|
||||
description = blocks.TextBlock(default="", required=False)
|
||||
contents = blocks.StreamBlock(
|
||||
[
|
||||
("learn_media", MediaLibraryContentBlock()),
|
||||
|
|
|
|||
|
|
@ -115,13 +115,32 @@ die der Fahrzeugbesitzer und die Fahrzeugbesitzerin in einem grösseren Schadenf
|
|||
),
|
||||
create_media_collection(
|
||||
title="Verankerung im Lernpfad",
|
||||
description="Anhand der Story von Rafael Fasel und seinem Ford Mustang lernst du in diesem berufstypischem Handlungsfeld alles rund um Motorfahrzeugversicherungen, wie man sein Auto optimal schützen kann, wie du vorgehst bei einem Fahrzeugwechsel, welche Aspekte du bei einer Offerte beachten musst und wie du dem Kunden die Lösung präsentierst.",
|
||||
contents=[
|
||||
create_internal_link_block(
|
||||
InternalLinkBlockFactory(
|
||||
title="Rafael kauft einen Ford Mustang",
|
||||
description="Anhand der Story von Rafael Fasel und seinem Ford Mustang lernst du in diesem berufstypischem Handlungsfeld alles rund um Motorfahrzeugversicherungen, wie man sein Auto optimal schützen kann, wie du vorgehst bei einem Fahrzeugwechsel, welche Aspekte du bei einer Offerte beachten musst und wie du dem Kunden die Lösung präsentierst.",
|
||||
title="Circle: Einstieg – Lernsequenz: Anwenden",
|
||||
url="/learn/versicherungsvermittlerin-lp/einstieg#lu-fahrzeug",
|
||||
)
|
||||
)
|
||||
),
|
||||
create_internal_link_block(
|
||||
InternalLinkBlockFactory(
|
||||
title="Circle: Analyse – Lernsequenz: Anwenden",
|
||||
url="/learn/versicherungsvermittlerin-lp/analyse#lu-fahrzeug",
|
||||
)
|
||||
),
|
||||
create_internal_link_block(
|
||||
InternalLinkBlockFactory(
|
||||
title="Circle: Lösung – Lernsequenz: Anwenden",
|
||||
url="/learn/versicherungsvermittlerin-lp/lösung#lu-fahrzeug",
|
||||
)
|
||||
),
|
||||
create_internal_link_block(
|
||||
InternalLinkBlockFactory(
|
||||
title="Circle: Abschluss – Lernsequenz: Anwenden",
|
||||
url="/learn/versicherungsvermittlerin-lp/abschluss#lu-fahrzeug",
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
create_media_collection(
|
||||
|
|
@ -198,13 +217,32 @@ Diese können negative Folgen verschiedener Art nach sich ziehen, darunter recht
|
|||
),
|
||||
create_media_collection(
|
||||
title="Verankerung im Lernpfad",
|
||||
description="Begleite Emma Durand und Ayla Yilmaz bei den Vorbereitungen auf ihre grosse Reise durch Amerika und lerne dabei, welche Risiken durch welche Versicherungen abgedeckt werden können.",
|
||||
contents=[
|
||||
create_internal_link_block(
|
||||
InternalLinkBlockFactory(
|
||||
title="Emma und Ayla campen durch Amerika",
|
||||
description="Begleite Emma Durand und Ayla Yilmaz bei den Vorbereitungen auf ihre grosse Reise durch Amerika und lerne dabei, welche Risiken durch welche Versicherungen abgedeckt werden können.",
|
||||
title="Circle: Einstieg – Lernsequenz: Anwenden",
|
||||
url="/learn/versicherungsvermittlerin-lp/einstieg#lu-reisen",
|
||||
)
|
||||
)
|
||||
),
|
||||
create_internal_link_block(
|
||||
InternalLinkBlockFactory(
|
||||
title="Circle: Analyse – Lernsequenz: Anwenden",
|
||||
url="/learn/versicherungsvermittlerin-lp/analyse#lu-reisen",
|
||||
)
|
||||
),
|
||||
create_internal_link_block(
|
||||
InternalLinkBlockFactory(
|
||||
title="Circle: Lösung – Lernsequenz: Anwenden",
|
||||
url="/learn/versicherungsvermittlerin-lp/lösung#lu-reisen",
|
||||
)
|
||||
),
|
||||
create_internal_link_block(
|
||||
InternalLinkBlockFactory(
|
||||
title="Circle: Abschluss – Lernsequenz: Anwenden",
|
||||
url="/learn/versicherungsvermittlerin-lp/abschluss#lu-reisen",
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
create_media_collection(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,262 @@
|
|||
# Generated by Django 3.2.13 on 2022-10-05 12:18
|
||||
|
||||
import wagtail.blocks
|
||||
import wagtail.fields
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("media_library", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="mediacategorypage",
|
||||
name="body",
|
||||
field=wagtail.fields.StreamField(
|
||||
[
|
||||
(
|
||||
"content_collection",
|
||||
wagtail.blocks.StructBlock(
|
||||
[
|
||||
("title", wagtail.blocks.TextBlock()),
|
||||
(
|
||||
"description",
|
||||
wagtail.blocks.TextBlock(
|
||||
default="", required=False
|
||||
),
|
||||
),
|
||||
(
|
||||
"contents",
|
||||
wagtail.blocks.StreamBlock(
|
||||
[
|
||||
(
|
||||
"learn_media",
|
||||
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
|
||||
),
|
||||
),
|
||||
(
|
||||
"page",
|
||||
wagtail.blocks.PageChooserBlock(
|
||||
page_type=[
|
||||
"learnpath.LearningContent"
|
||||
],
|
||||
required=False,
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"external_link",
|
||||
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
|
||||
),
|
||||
),
|
||||
(
|
||||
"page",
|
||||
wagtail.blocks.PageChooserBlock(
|
||||
page_type=[
|
||||
"learnpath.LearningContent"
|
||||
],
|
||||
required=False,
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"internal_link",
|
||||
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
|
||||
),
|
||||
),
|
||||
(
|
||||
"page",
|
||||
wagtail.blocks.PageChooserBlock(
|
||||
page_type=[
|
||||
"learnpath.LearningContent"
|
||||
],
|
||||
required=False,
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
(
|
||||
"relative_link",
|
||||
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
|
||||
),
|
||||
),
|
||||
(
|
||||
"page",
|
||||
wagtail.blocks.PageChooserBlock(
|
||||
page_type=[
|
||||
"learnpath.LearningContent"
|
||||
],
|
||||
required=False,
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
)
|
||||
],
|
||||
null=True,
|
||||
use_json_field=True,
|
||||
),
|
||||
),
|
||||
]
|
||||
|
|
@ -81,7 +81,7 @@ class InternalLinkBlockFactory(wagtail_factories.StructBlockFactory):
|
|||
title = "Platzhalter interner Link"
|
||||
description = "Link to a Learning Content"
|
||||
link_display_text = "Lerneinheit anzeigen"
|
||||
url = "/learn/versicherungsvermittlerin-lp/basis/einleitung-circle-basis"
|
||||
url = "/learn/versicherungsvermittlerin-lp/basis"
|
||||
# TODO: page = blocks.PageChooserBlock mit Titel etc
|
||||
|
||||
|
||||
|
|
@ -100,7 +100,7 @@ class RelativeLinkBlockFactory(wagtail_factories.StructBlockFactory):
|
|||
model = RelativeLinkBlock
|
||||
|
||||
title = "Platzhalter Querverweis"
|
||||
description = "Lernmedium: Verkehrsrechtsschutz – Buch «Sach- und Vermögensversicherungen/Kapitel 12.3»"
|
||||
description = "Handlungsfeld"
|
||||
link_display_text = "Handlungsfeld anzeigen"
|
||||
icon_url = "/static/icons/demo/icon-hf-reisen.svg"
|
||||
url = "/media/versicherungsvermittlerin-media/category/fahrzeug"
|
||||
|
|
@ -117,11 +117,11 @@ def create_relative_link_block(link_block=None):
|
|||
}
|
||||
|
||||
|
||||
def create_media_collection(title, contents=None):
|
||||
def create_media_collection(title, contents=None, description=None):
|
||||
if contents is None:
|
||||
contents = []
|
||||
|
||||
return {
|
||||
result = {
|
||||
"id": str(uuid.uuid4()),
|
||||
"type": "content_collection",
|
||||
"value": {
|
||||
|
|
@ -130,6 +130,11 @@ def create_media_collection(title, contents=None):
|
|||
},
|
||||
}
|
||||
|
||||
if description:
|
||||
result["value"]["description"] = description
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def create_document_collection(document_ids=None):
|
||||
if document_ids is None:
|
||||
|
|
|
|||
Loading…
Reference in New Issue