From ee7ed0db1f7f6c3d6b7d3879dd369611e938dda9 Mon Sep 17 00:00:00 2001 From: Mario Linz Date: Tue, 14 Jun 2022 10:30:40 +0200 Subject: [PATCH] =?UTF-8?q?Zuweisung=20von=20Artikeln=20zu=20Seiten=20m?= =?UTF-8?q?=C3=B6glich.=20Somit=20werden=20keine=20Content-Blocks=20mehr?= =?UTF-8?q?=20ben=C3=B6tigt=20und=20alle=20Artikel=20k=C3=B6nnen=20=C3=BCb?= =?UTF-8?q?er=20die=20articles-Collection=20gepflegt=20udn=20zugewiesen=20?= =?UTF-8?q?werden.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/collections/content.yml | 14 +++++++------- api/collections/fields/_article.yml | 2 +- src/components/routes/Content.svelte | 14 +++++++++----- src/components/routes/Home.svelte | 4 ---- src/components/widgets/Article.svelte | 10 +++++++--- src/components/widgets/ArticlesList.svelte | 22 +++++++++++++++------- src/css/theme-2022/components/article.less | 2 +- types/global.d.ts | 4 ++-- 8 files changed, 42 insertions(+), 30 deletions(-) diff --git a/api/collections/content.yml b/api/collections/content.yml index d3ffbc2..17b097a 100644 --- a/api/collections/content.yml +++ b/api/collections/content.yml @@ -141,10 +141,10 @@ fields: helperText: de: "Sind mehr als ein Stichwort mit einer Seite verknüpft, führt die Priorität (z.B.: eine Zahl von 0..10..x) der gefundenen Seiten zu einer automatischen Vorauswahl aus den gefundenen Seiten." en: "If more than one keyword is linked to a page, the priority (e.g. a number 0..10..x) of the pages found leads to an automatic preselection from the pages found." - - name: blocks - type: object[] - meta: - label: { de: "Artikel dieser Seite", en: "Page Articles" } - collapse: { titleFieldName: "article.content.title" } - subFields: - - !include fields/_article.yml + # - name: blocks + # type: object[] + # meta: + # label: { de: "Artikel dieser Seite", en: "Page Articles" } + # collapse: { titleFieldName: "article.content.title" } + # subFields: + # - !include fields/_article.yml diff --git a/api/collections/fields/_article.yml b/api/collections/fields/_article.yml index 62bed8f..001275b 100644 --- a/api/collections/fields/_article.yml +++ b/api/collections/fields/_article.yml @@ -58,7 +58,7 @@ subFields: choices: endpoint: "content" mapping: - id: "id" + id: "path" name: "path" params: sort: "path" diff --git a/src/components/routes/Content.svelte b/src/components/routes/Content.svelte index a69cb66..8a0b861 100644 --- a/src/components/routes/Content.svelte +++ b/src/components/routes/Content.svelte @@ -5,6 +5,8 @@ import { navigate } from "svelte-routing" import Image from "../widgets/Image.svelte" + import ArticlesList from "../widgets/ArticlesList.svelte" + // import Article from "../widgets/Article.svelte" export let path: string @@ -13,7 +15,7 @@ let connectedContentNotFound: boolean = false $: currentDomain = window.location.protocol + "//" + window.location.host - const load = (type?: string) => { + const loadContent = (type?: string) => { // Set default API call filter let filter = { locale: $currentLang, @@ -45,6 +47,7 @@ if (type === "changedLanguage") { let newPath = c.path + $location.search window.history.pushState({}, document.getElementsByTagName("title")[0].innerHTML, newPath) + path = newPath } connectedContentNotFound = false @@ -69,11 +72,11 @@ currentLang.subscribe(() => { if (content) { - load("changedLanguage") + loadContent("changedLanguage") } }) - $: if (path) load() + $: if (path) loadContent() @@ -86,11 +89,12 @@ {#if loading} {:else if content} - + + {:else}
diff --git a/src/components/routes/Home.svelte b/src/components/routes/Home.svelte index 16d0396..3f897f4 100644 --- a/src/components/routes/Home.svelte +++ b/src/components/routes/Home.svelte @@ -1,14 +1,10 @@ {#if article && published} -
+
{#if article?.layout?.variant === "top"} {#if article?.content?.types?.media?.files?.length} { + let filter = { + "article.general.locale": $currentLang, + } + + if (tag) { + filter["article.general.tags"] = { $in: [tag] } + } + + if (path) { + filter["article.general.pages"] = { $in: [path] } + } + + getArticles("articles", { filter }).then((response) => { articleEntries = response }) } diff --git a/src/css/theme-2022/components/article.less b/src/css/theme-2022/components/article.less index f9ce54b..2e0fb9c 100644 --- a/src/css/theme-2022/components/article.less +++ b/src/css/theme-2022/components/article.less @@ -1,7 +1,7 @@ article, .article { overflow-wrap: anywhere; - border: 1px dashed @on-background; + // border: 1px dashed @on-background; & ~ article, & ~ .article { diff --git a/types/global.d.ts b/types/global.d.ts index e3b7651..0d2bd03 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -27,7 +27,7 @@ interface Content { tags?: string[] path: string name: string - blocks: ContentBlock[] + blocks?: ContentBlock[] } interface GeneralInfo { @@ -68,7 +68,7 @@ interface GeneralInfo { } interface TibiArticle { - id: string + id?: string article: { general: { public: boolean