Skip to content

Commit 784dc15

Browse files
Implement multiple authors for lectures (#250)
Co-authored-by: Felix <[email protected]>
1 parent c43b0ad commit 784dc15

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

components/course/Header.vue

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,27 @@
1212
<SectionTitle full size="xl" :subheading="category" :heading="title" />
1313
<p>
1414
{{ t('Body.CreatedBy') }}
15-
<span class="text-accent">{{ author }}</span>
15+
<span v-if="authors.length === 1">
16+
<a class="text-accent" :href="authors[0].url">{{ authors[0].name }}</a>
17+
</span>
18+
<span v-else-if="authors.length === 2">
19+
<a class="text-accent" :href="authors[0].url">{{ authors[0].name }}</a>
20+
{{ t('Body.And') }}
21+
<a class="text-accent" :href="authors[1].url">{{ authors[1].name }}</a>
22+
</span>
23+
<span v-else>
24+
<template v-for="(author, index) in authors">
25+
<template v-if="index !== authors.length - 1">
26+
<span>
27+
<a class="text-accent" :href="author.url">{{ author.name }}</a>,
28+
</span>
29+
</template>
30+
<template v-else>
31+
{{ t('Body.And') }}
32+
<a class="text-accent" :href="author.url">{{ author.name }}</a>
33+
</template>
34+
</template>
35+
</span>
1636
</p>
1737
</div>
1838

@@ -47,8 +67,8 @@ export default defineComponent({
4767
return props.data?.title ?? '';
4868
});
4969
50-
const author = computed(() => {
51-
return props.data?.author ?? '';
70+
const authors = computed(() => {
71+
return props.data?.authors ?? '';
5272
});
5373
5474
const lastUpdated = computed(() => {
@@ -59,7 +79,7 @@ export default defineComponent({
5979
return `${t(month.string).substring(0, 3)}, ${year}`;
6080
});
6181
62-
return { image, title, category, author, lastUpdated, t };
82+
return { image, title, category, authors, lastUpdated, t };
6383
},
6484
});
6585
</script>

locales/de.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@
453453
"GetMorphcoins": "Du willst kein Geld bezahlen? Die Coins kannst du auch auf andere Weise erhalten",
454454
"MoreComingSoon": "Mehr folgt bald...",
455455
"CreatedBy": "Erstellt von",
456+
"And": "und",
456457
"LastUpdated": "Zuletzt aktualisiert",
457458
"VerifyCertificate": "Bitte gib das Zertifikatspasswort ein, um das Zertifikat anzuzeigen.",
458459
"EnterNewTag": "Gib ein neues Tag ein",

locales/en-US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@
451451
"GetMorphcoins": "Don't want to pay? You can get coins by other ways",
452452
"MoreComingSoon": "More coming soon...",
453453
"CreatedBy": "Created by",
454+
"And": "and",
454455
"LastUpdated": "Last Updated",
455456
"VerifyCertificate": "Please enter certificate password in order to view certificate.",
456457
"EnterNewTag": "Enter a new tag",

types/courseTypes.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
1+
type Author = {
2+
name: string;
3+
url: string;
4+
};
25

36
export class Course{
4-
author: string = "";
7+
authors: Author[] = [];
58
category: string = "";
69
description: string = "";
710
id: string = "";

0 commit comments

Comments
 (0)