diff --git a/api/collections/articles.yml b/api/collections/articles.yml index bed29df..d1c0d50 100644 --- a/api/collections/articles.yml +++ b/api/collections/articles.yml @@ -21,6 +21,7 @@ meta: columns: - article.general.public - article.content.title + - article.general.type - article.general.sort - source: article.general.locale type: flag @@ -32,6 +33,7 @@ meta: - label: { de: "Titel", en: "Title" } source: article.content.title filter: true + - article.general.type - article.general.sort - source: article.general.locale type: flag diff --git a/api/collections/fields/article/_article.yml b/api/collections/fields/article/_article.yml index 1277e5c..8943471 100644 --- a/api/collections/fields/article/_article.yml +++ b/api/collections/fields/article/_article.yml @@ -24,6 +24,21 @@ subFields: helperText: de: "Der Artikel wird auf der Seite angezeigt." en: "This article is displayed on the page." + - name: type + type: string + meta: + filter: true + helperText: + de: "Definiert allgemeinen Typ des Artikels." + en: "Defines general type of the article." + widget: select + label: + de: Typ des Artikels + en: Article type + defaultValue: default + choices: + - { id: "default", name: { de: "Artikel", en: "Article" } } + - { id: "news", name: { de: "News", en: "News" } } - !include ../_locale.yml - name: tags type: string[] @@ -158,10 +173,13 @@ subFields: - name: variant type: string meta: + helperText: + de: "Definiert das visuelle Erscheinungsbild der aller Teaser-Informationen des Artikels." + en: "Defines the visual appearance of all teaser information of the article." widget: select label: - de: Erscheinungsbild - en: Appearance + de: Teaser Erscheinungsbild + en: Teaser Layout defaultValue: default choices: - { id: "top", name: { de: "Artikelbild oben", en: "Article picture top" } } diff --git a/src/components/routes/ArticleDetails.svelte b/src/components/routes/ArticleDetails.svelte index 1428de5..898946c 100644 --- a/src/components/routes/ArticleDetails.svelte +++ b/src/components/routes/ArticleDetails.svelte @@ -1,34 +1,9 @@ -
-
-
- {#each articleEntries || [] as entry} -
- {/each} -
-
-
+{#if entry} + +{/if} diff --git a/src/components/routes/Content.svelte b/src/components/routes/Content.svelte index 8a21d7e..f02da32 100644 --- a/src/components/routes/Content.svelte +++ b/src/components/routes/Content.svelte @@ -6,10 +6,9 @@ import Image from "../widgets/Image.svelte" import ArticlesList from "../widgets/ArticlesList.svelte" - import Article from "../widgets/Article.svelte" + import ArticleDetails from "../routes/ArticleDetails.svelte" export let path: string - let oldPath: string = null let loading = true let content: Content @@ -63,8 +62,6 @@ content = null } - oldPath = path - // Redirect to HOME if no content has been found. So the page 404 content will never shown. if (!content) { navigate("/") @@ -103,7 +100,6 @@ getArticles("articles", apiParams) .then((respoonse) => { article = respoonse[0] - oldPath = path }) .finally(() => { loading = false @@ -166,7 +162,7 @@ {#if loading} {:else if article} -
+ {:else if content} {:else} diff --git a/src/components/widgets/details/Default.svelte b/src/components/widgets/details/Default.svelte new file mode 100644 index 0000000..f613e63 --- /dev/null +++ b/src/components/widgets/details/Default.svelte @@ -0,0 +1,29 @@ + + +{#if entry} +
+
+
+
+ {#if entry?.article?.content?.title} +

{@html entry?.article?.content?.title}

+ {/if} + + {#if entry?.article?.content?.subtitle} +
{@html entry?.article?.content?.subtitle}
+ {/if} + + {#if entry?.article?.content?.types?.teaser} + + {/if} + + {#if entry?.article?.content?.types?.details} +
{@html entry?.article?.content?.types?.details}
+ {/if} +
+
+
+
+{/if} diff --git a/src/components/widgets/details/News.svelte b/src/components/widgets/details/News.svelte new file mode 100644 index 0000000..f613e63 --- /dev/null +++ b/src/components/widgets/details/News.svelte @@ -0,0 +1,29 @@ + + +{#if entry} +
+
+
+
+ {#if entry?.article?.content?.title} +

{@html entry?.article?.content?.title}

+ {/if} + + {#if entry?.article?.content?.subtitle} +
{@html entry?.article?.content?.subtitle}
+ {/if} + + {#if entry?.article?.content?.types?.teaser} + + {/if} + + {#if entry?.article?.content?.types?.details} +
{@html entry?.article?.content?.types?.details}
+ {/if} +
+
+
+
+{/if} diff --git a/src/components/widgets/details/index.ts b/src/components/widgets/details/index.ts new file mode 100644 index 0000000..83928f7 --- /dev/null +++ b/src/components/widgets/details/index.ts @@ -0,0 +1,7 @@ +import Default from "./Default.svelte" +import News from "./News.svelte" + +export default { + default: Default, + news: News, +} diff --git a/src/css/theme-2022/components/article.less b/src/css/theme-2022/components/article.less index eecb8c4..c01b740 100644 --- a/src/css/theme-2022/components/article.less +++ b/src/css/theme-2022/components/article.less @@ -26,3 +26,14 @@ article, text-decoration: underline; } } + +.article-details { + &.default { + background: #000; + color: #fff; + } + + &.news { + background: #fc0; + } +} diff --git a/types/global.d.ts b/types/global.d.ts index 8deeca0..1edebed 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -75,6 +75,7 @@ interface TibiArticle { article: { general: { public: boolean + type: string locale: string publish_date: { from: string