Embed media library as course session specific page
This commit is contained in:
parent
38d753de42
commit
e8d6a9c784
|
|
@ -5,11 +5,11 @@ import * as log from "loglevel";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
mediaLibraryPageSlug: string;
|
courseSlug: string;
|
||||||
mediaCategorySlug: string;
|
mediaCategorySlug: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
log.debug("MLMediaListPage created", props.mediaCategorySlug);
|
log.debug("MLMediaListPage created", props.courseSlug);
|
||||||
|
|
||||||
const mediaStore = useMediaLibraryStore();
|
const mediaStore = useMediaLibraryStore();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,16 @@ import { onMounted } from "vue";
|
||||||
log.debug("MediaLibraryView created");
|
log.debug("MediaLibraryView created");
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
mediaLibraryPageSlug: string;
|
courseSlug: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const mediaLibraryStore = useMediaLibraryStore();
|
const mediaLibraryStore = useMediaLibraryStore();
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
log.debug("MediaLibraryView mounted", props.mediaLibraryPageSlug);
|
log.debug("MediaLibraryView mounted", props.courseSlug);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await mediaLibraryStore.loadMediaLibraryPage(props.mediaLibraryPageSlug);
|
await mediaLibraryStore.loadMediaLibraryPage(`${props.courseSlug}-media`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(error);
|
log.error(error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ const router = createRouter({
|
||||||
component: DashboardPage,
|
component: DashboardPage,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/media/:mediaLibraryPageSlug",
|
path: "/course/:courseSlug/media",
|
||||||
props: true,
|
props: true,
|
||||||
component: () => import("@/pages/mediaLibrary/MLParentPage.vue"),
|
component: () => import("@/pages/mediaLibrary/MLParentPage.vue"),
|
||||||
children: [
|
children: [
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class MediaLibraryPage(CourseBasePage):
|
||||||
super(MediaLibraryPage, self).save(clean, user, log_action, **kwargs)
|
super(MediaLibraryPage, self).save(clean, user, log_action, **kwargs)
|
||||||
|
|
||||||
def get_frontend_url(self):
|
def get_frontend_url(self):
|
||||||
return f"/media/{self.slug}"
|
return f"/course/{self.slug.replace('-media', '')}/media"
|
||||||
|
|
||||||
|
|
||||||
class MediaCategoryPage(CourseBasePage):
|
class MediaCategoryPage(CourseBasePage):
|
||||||
|
|
@ -95,7 +95,7 @@ class MediaCategoryPage(CourseBasePage):
|
||||||
def get_frontend_url(self):
|
def get_frontend_url(self):
|
||||||
r = re.compile(r"^(?P<coursePart>.+?)-media-cat-(?P<catPart>.+)$")
|
r = re.compile(r"^(?P<coursePart>.+?)-media-cat-(?P<catPart>.+)$")
|
||||||
m = r.match(self.slug)
|
m = r.match(self.slug)
|
||||||
return f"/media/{m.group('coursePart')}-media/category/{m.group('catPart')}"
|
return f"/course/{m.group('coursePart')}/media/category/{m.group('catPart')}"
|
||||||
|
|
||||||
|
|
||||||
class LibraryDocument(AbstractDocument):
|
class LibraryDocument(AbstractDocument):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue