Merged in feature/vbv-293-mediathek-link (pull request #43)

Feature/vbv 293 mediathek link

Approved-by: Christian Cueni
This commit is contained in:
Daniel Egger 2023-03-15 05:55:24 +00:00 committed by Christian Cueni
commit 0353584e55
4 changed files with 119 additions and 27 deletions

View File

@ -1,7 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import LearningContentContainer from "@/components/learningPath/LearningContentContainer.vue"; import LearningContentContainer from "@/components/learningPath/LearningContentContainer.vue";
import { useCircleStore } from "@/stores/circle"; import { useCircleStore } from "@/stores/circle";
import type { LearningContent } from "@/types"; import type { LearningContent, LearningContentType } from "@/types";
import log from "loglevel"; import log from "loglevel";
import { computed } from "vue"; import { computed } from "vue";
@ -9,6 +9,7 @@ import DescriptionBlock from "@/components/learningPath/blocks/DescriptionBlock.
import DescriptionTextBlock from "@/components/learningPath/blocks/DescriptionTextBlock.vue"; import DescriptionTextBlock from "@/components/learningPath/blocks/DescriptionTextBlock.vue";
import FeedbackBlock from "@/components/learningPath/blocks/FeedbackBlock.vue"; import FeedbackBlock from "@/components/learningPath/blocks/FeedbackBlock.vue";
import IframeBlock from "@/components/learningPath/blocks/IframeBlock.vue"; import IframeBlock from "@/components/learningPath/blocks/IframeBlock.vue";
import MediaLibraryBlock from "@/components/learningPath/blocks/MediaLibraryBlock.vue";
import PlaceholderBlock from "@/components/learningPath/blocks/PlaceholderBlock.vue"; import PlaceholderBlock from "@/components/learningPath/blocks/PlaceholderBlock.vue";
import VideoBlock from "@/components/learningPath/blocks/VideoBlock.vue"; import VideoBlock from "@/components/learningPath/blocks/VideoBlock.vue";
@ -29,7 +30,7 @@ const block = computed(() => {
}); });
// can't use the type as component name, as some are reserved HTML components, e.g. video // can't use the type as component name, as some are reserved HTML components, e.g. video
const COMPONENTS: Record<string, any> = { const COMPONENTS: Record<LearningContentType, any> = {
// todo: can we find a better type here than any? ^ // todo: can we find a better type here than any? ^
placeholder: PlaceholderBlock, placeholder: PlaceholderBlock,
video: VideoBlock, video: VideoBlock,
@ -39,6 +40,10 @@ const COMPONENTS: Record<string, any> = {
test: IframeBlock, test: IframeBlock,
learningmodule: IframeBlock, learningmodule: IframeBlock,
feedback: FeedbackBlock, feedback: FeedbackBlock,
book: DescriptionBlock,
document: DescriptionBlock,
media_library: MediaLibraryBlock,
online_training: DescriptionBlock,
}; };
const DEFAULT_BLOCK = DescriptionBlock; const DEFAULT_BLOCK = DescriptionBlock;

View File

@ -66,8 +66,8 @@ def command():
title="Versicherungsvermittler/-in", title="Versicherungsvermittler/-in",
) )
create_vv_new_competence_profile(course_id=COURSE_VERSICHERUNGSVERMITTLERIN_ID) create_vv_new_competence_profile(course_id=COURSE_VERSICHERUNGSVERMITTLERIN_ID)
create_vv_new_learning_path()
create_default_media_library(course_id=COURSE_VERSICHERUNGSVERMITTLERIN_ID) create_default_media_library(course_id=COURSE_VERSICHERUNGSVERMITTLERIN_ID)
create_vv_new_learning_path()
# Überbetriebliche Kurse DE # Überbetriebliche Kurse DE
create_versicherungsvermittlerin_with_categories( create_versicherungsvermittlerin_with_categories(
@ -429,7 +429,7 @@ def command():
"michael.meier@example.com", "michael.meier@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-fahrzeug-lc-mediathek", "überbetriebliche-kurse-lp-circle-fahrzeug-lc-mediathek-fahrzeug",
"success", "success",
"michael.meier@example.com", "michael.meier@example.com",
), ),
@ -494,7 +494,7 @@ def command():
"michael.meier@example.com", "michael.meier@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek", "überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek-haushalt-teil-1",
"success", "success",
"michael.meier@example.com", "michael.meier@example.com",
), ),
@ -509,7 +509,7 @@ def command():
"michael.meier@example.com", "michael.meier@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek", "überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek-haushalt-teil-1",
"success", "success",
"michael.meier@example.com", "michael.meier@example.com",
), ),
@ -534,7 +534,7 @@ def command():
"michael.meier@example.com", "michael.meier@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek", "überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek-haushalt-teil-1",
"success", "success",
"michael.meier@example.com", "michael.meier@example.com",
), ),
@ -674,7 +674,7 @@ def command():
"lina.egger@example.com", "lina.egger@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-fahrzeug-lc-mediathek", "überbetriebliche-kurse-lp-circle-fahrzeug-lc-mediathek-fahrzeug",
"success", "success",
"lina.egger@example.com", "lina.egger@example.com",
), ),
@ -739,7 +739,7 @@ def command():
"lina.egger@example.com", "lina.egger@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek", "überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek-haushalt-teil-1",
"success", "success",
"lina.egger@example.com", "lina.egger@example.com",
), ),
@ -779,7 +779,7 @@ def command():
"lina.egger@example.com", "lina.egger@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek", "überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek-haushalt-teil-1",
"success", "success",
"lina.egger@example.com", "lina.egger@example.com",
), ),
@ -804,7 +804,7 @@ def command():
"lina.egger@example.com", "lina.egger@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-haushalt-teil-2-lc-mediathek", "überbetriebliche-kurse-lp-circle-haushalt-teil-2-lc-mediathek-haushalt-teil-2",
"success", "success",
"lina.egger@example.com", "lina.egger@example.com",
), ),
@ -814,7 +814,7 @@ def command():
"lina.egger@example.com", "lina.egger@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek", "überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek-haushalt-teil-1",
"success", "success",
"lina.egger@example.com", "lina.egger@example.com",
), ),
@ -929,7 +929,7 @@ def command():
"evelyn.schmid@example.com", "evelyn.schmid@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-fahrzeug-lc-mediathek", "überbetriebliche-kurse-lp-circle-fahrzeug-lc-mediathek-fahrzeug",
"success", "success",
"evelyn.schmid@example.com", "evelyn.schmid@example.com",
), ),
@ -994,7 +994,7 @@ def command():
"evelyn.schmid@example.com", "evelyn.schmid@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek", "überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek-haushalt-teil-1",
"success", "success",
"evelyn.schmid@example.com", "evelyn.schmid@example.com",
), ),
@ -1024,7 +1024,7 @@ def command():
"evelyn.schmid@example.com", "evelyn.schmid@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek", "überbetriebliche-kurse-lp-circle-haushalt-teil-1-lc-mediathek-haushalt-teil-1",
"success", "success",
"evelyn.schmid@example.com", "evelyn.schmid@example.com",
), ),
@ -1059,7 +1059,7 @@ def command():
"evelyn.schmid@example.com", "evelyn.schmid@example.com",
), ),
( (
"überbetriebliche-kurse-lp-circle-haushalt-teil-2-lc-mediathek", "überbetriebliche-kurse-lp-circle-haushalt-teil-2-lc-mediathek-haushalt-teil-2",
"success", "success",
"evelyn.schmid@example.com", "evelyn.schmid@example.com",
), ),

View File

@ -1,6 +1,7 @@
import wagtail_factories import wagtail_factories
from django.conf import settings from django.conf import settings
from django.core.management import call_command from django.core.management import call_command
from slugify import slugify
from wagtail.models import Locale, Page, Site from wagtail.models import Locale, Page, Site
from wagtail_localize.models import LocaleSynchronization from wagtail_localize.models import LocaleSynchronization
@ -14,6 +15,7 @@ from vbv_lernwelt.learnpath.tests.learning_path_factories import (
LearningPathFactory, LearningPathFactory,
LearningSequenceFactory, LearningSequenceFactory,
LearningUnitFactory, LearningUnitFactory,
MediaLibraryBlockFactory,
TopicFactory, TopicFactory,
) )
@ -149,10 +151,37 @@ damit du erfolgreich mit deinem Lernpfad (durch-)starten kannst.
title="Verschaffe dir einen Überblick", title="Verschaffe dir einen Überblick",
parent=circle, parent=circle,
) )
LearningContentFactory(
title="Mediathek", first_title = title.split()[0]
parent=circle, if first_title in [
) "Haushalt",
"Reisen",
"Wohneigentum",
"KMU",
"Einkommenssicherung",
"Pensionierung",
"Gesundheit",
]:
LearningContentFactory(
title=f"Mediathek {title}",
parent=circle,
contents=[
(
"media_library",
MediaLibraryBlockFactory(
# TODO: sollen die ÜKs auf die gleichen Mediatheken verlinken
# wie im Verischerungsvermittler?
url=f"/media/überbetriebliche-kurse-media/category/{slugify(first_title)}"
),
)
],
)
else:
LearningContentFactory(
title="Mediathek",
parent=circle,
)
LearningContentFactory( LearningContentFactory(
title="Vorbereitungsauftrag", title="Vorbereitungsauftrag",
parent=circle, parent=circle,
@ -209,8 +238,16 @@ damit du erfolgreich mit deinem Lernpfad (durch-)starten kannst.
parent=circle, parent=circle,
) )
LearningContentFactory( LearningContentFactory(
title="Mediathek", title=f"Mediathek {title}",
parent=circle, parent=circle,
contents=[
(
"media_library",
MediaLibraryBlockFactory(
url=f"/media/überbetriebliche-kurse-media/category/{slugify(title)}"
),
)
],
) )
LearningContentFactory( LearningContentFactory(
title="Vorbereitungsauftrag", title="Vorbereitungsauftrag",

View File

@ -1,6 +1,7 @@
import wagtail_factories import wagtail_factories
from django.conf import settings from django.conf import settings
from django.core.management import call_command from django.core.management import call_command
from slugify import slugify
from wagtail.models import Locale, Page, Site from wagtail.models import Locale, Page, Site
from wagtail.rich_text import RichText from wagtail.rich_text import RichText
from wagtail_localize.models import LocaleSynchronization from wagtail_localize.models import LocaleSynchronization
@ -19,6 +20,7 @@ from vbv_lernwelt.learnpath.tests.learning_path_factories import (
LearningPathFactory, LearningPathFactory,
LearningSequenceFactory, LearningSequenceFactory,
LearningUnitFactory, LearningUnitFactory,
MediaLibraryBlockFactory,
ResourceBlockFactory, ResourceBlockFactory,
TestBlockFactory, TestBlockFactory,
TopicFactory, TopicFactory,
@ -372,8 +374,16 @@ def create_circle_fahrzeug(lp, title="Fahrzeug"):
], ],
) )
LearningContentFactory( LearningContentFactory(
title="Mediathek", title=f"Mediathek {title}",
parent=circle, parent=circle,
contents=[
(
"media_library",
MediaLibraryBlockFactory(
url=f"/media/versicherungsvermittler-in-media/category/{slugify(title)}"
),
)
],
) )
LearningSequenceFactory(title="Einstieg", parent=circle, icon="it-icon-ls-watch") LearningSequenceFactory(title="Einstieg", parent=circle, icon="it-icon-ls-watch")
@ -467,8 +477,16 @@ def create_circle_rechtsstreitigkeiten(lp, title="Rechtsstreitigkeiten"):
], ],
) )
LearningContentFactory( LearningContentFactory(
title="Mediathek", title=f"Mediathek {title}",
parent=circle, parent=circle,
contents=[
(
"media_library",
MediaLibraryBlockFactory(
url=f"/media/versicherungsvermittler-in-media/category/{slugify(title)}"
),
)
],
) )
LearningSequenceFactory( LearningSequenceFactory(
@ -507,8 +525,16 @@ def create_circle_reisen(lp, title="Reisen"):
], ],
) )
LearningContentFactory( LearningContentFactory(
title="Mediathek", title=f"Mediathek {title}",
parent=circle, parent=circle,
contents=[
(
"media_library",
MediaLibraryBlockFactory(
url=f"/media/versicherungsvermittler-in-media/category/{slugify(title)}"
),
)
],
) )
LearningSequenceFactory(title="Einstieg", parent=circle, icon="it-icon-ls-watch") LearningSequenceFactory(title="Einstieg", parent=circle, icon="it-icon-ls-watch")
@ -577,8 +603,16 @@ def create_circle_einkommenssicherung(lp, title="Einkommenssicherung"):
], ],
) )
LearningContentFactory( LearningContentFactory(
title="Mediathek", title=f"Mediathek {title}",
parent=circle, parent=circle,
contents=[
(
"media_library",
MediaLibraryBlockFactory(
url=f"/media/versicherungsvermittler-in-media/category/{slugify(title)}"
),
)
],
) )
LearningSequenceFactory(title="Einstieg", parent=circle, icon="it-icon-ls-watch") LearningSequenceFactory(title="Einstieg", parent=circle, icon="it-icon-ls-watch")
@ -652,8 +686,16 @@ def create_circle_standard_small(
], ],
) )
LearningContentFactory( LearningContentFactory(
title="Mediathek", title=f"Mediathek {title}",
parent=circle, parent=circle,
contents=[
(
"media_library",
MediaLibraryBlockFactory(
url=f"/media/versicherungsvermittler-in-media/category/{slugify(title, allow_unicode=True)}"
),
)
],
) )
if lu_title is None: if lu_title is None:
@ -688,8 +730,16 @@ def create_circle_standard(lp, title, lc_title, goals=None, description=None):
], ],
) )
LearningContentFactory( LearningContentFactory(
title="Mediathek", title=f"Mediathek {title}",
parent=circle, parent=circle,
contents=[
(
"media_library",
MediaLibraryBlockFactory(
url=f"/media/versicherungsvermittler-in-media/category/{slugify(title)}"
),
)
],
) )
LearningSequenceFactory(title="Einstieg", parent=circle, icon="it-icon-ls-watch") LearningSequenceFactory(title="Einstieg", parent=circle, icon="it-icon-ls-watch")