diff --git a/api/collections/articles.yml b/api/collections/articles.yml index d1c0d50..a6de6f7 100644 --- a/api/collections/articles.yml +++ b/api/collections/articles.yml @@ -38,21 +38,21 @@ meta: - source: article.general.locale type: flag # Filter Navigation-Items in Collection-Navigation - navigationFilter: - - label: { de: "News", en: "News" } - mdiIcon: filter-outline - params: - - sort: article.general.sort - # - s.article.general.public: true - - w.article.content.title: lor - - s.article.general.locale: de - - label: { de: "Diam", en: "Diam" } - mdiIcon: filter-outline - params: - - sort: article.general.sort - - s.article.general.public: true - - w.article.content.title: diam - - s.article.general.locale: de + # navigationFilter: + # - label: { de: "News", en: "News" } + # mdiIcon: filter-outline + # params: + # - sort: article.general.sort + # # - s.article.general.public: true + # - w.article.content.title: lor + # - s.article.general.locale: de + # - label: { de: "Diam", en: "Diam" } + # mdiIcon: filter-outline + # params: + # - sort: article.general.sort + # - s.article.general.public: true + # - w.article.content.title: diam + # - s.article.general.locale: de imageFilter: xs: diff --git a/api/collections/content.yml b/api/collections/content.yml index 437f85f..47f591a 100644 --- a/api/collections/content.yml +++ b/api/collections/content.yml @@ -55,6 +55,12 @@ meta: source: meta subFields: - source: meta + - name: assignments + meta: + label: { de: "Verknüpfungen", en: "Assignments" } + source: meta + subFields: + - source: pages imageFilter: xs: @@ -135,13 +141,32 @@ fields: de: "Der Pfad muss eindeutig sein und ohne ein Slash (/) beginnen und enden." en: "The path must be unique and must start and end without a slash (/)." - !include fields/_locale.yml + - name: pages + type: string[] + meta: + hideInRoot: true + helperText: + de: "Verknüpft Seiten mit beliebigen anderen Seiten." + en: "Links the page to any other page." + widget: chipArray + label: + de: Verknüpfung zu Seiten + en: Assignment to pages + defaultValue: [] + choices: + endpoint: "content" + mapping: + id: "id" + name: "path" + params: + sort: "path" - name: tags type: string[] meta: hideInRoot: true helperText: - de: "Seiten können miteinander verknüpft werden. Entsprechende Seiten in einer anderen Sprache, die mit den selben zugewiesenen Schlagworten gekennzeichnet sind, können bei Umschaltung der Seitensprache gefunden werden. Wählen Sie einen existierenden Eintrag aus der Liste oder geben Sie ein neues Schlagwort ein und bestätigen mit Enter." - en: "Pages can be linked together. Corresponding pages in another language, marked with the same assigned keywords, can be found by switching the page language. Select an existing entry from the list or enter a new keyword and confirm with Enter." + de: "Über die Zuweisung von Schlagworten, können Seiten noch einmal genauer kategorisiert werden." + en: "Pages can be categorized more precisely by assigning keywords." widget: chipArray label: de: Schlagwort / Tag / Label diff --git a/api/collections/fields/article/_article-assignments.yml b/api/collections/fields/article/_article-assignments.yml new file mode 100644 index 0000000..fbefa45 --- /dev/null +++ b/api/collections/fields/article/_article-assignments.yml @@ -0,0 +1,60 @@ +name: assignments +type: object +meta: + label: { de: "Verknüpfung", en: "Assignment" } +subFields: + - name: pages + type: string[] + meta: + helperText: + de: "Verknüpft den Artikel mit beliebigen Seiten." + en: "Links the article to any page." + widget: chipArray + label: + de: Verknüpfung zu Seiten + en: Assignment to pages + defaultValue: [] + choices: + endpoint: "content" + mapping: + id: "path" + name: "path" + params: + sort: "path" + - name: articles + type: string[] + meta: + helperText: + de: "Verknüpft den Artikel mit beliebigen Artikeln." + en: "Links the article to any articles." + widget: chipArray + label: + de: Verknüpfung zu Artikeln + en: Assignment to articles + defaultValue: [] + choices: + endpoint: "articles" + mapping: + id: "id" + name: "title" + params: + sort: "title" + - name: tags + type: string[] + meta: + helperText: + de: "Über die Zuweisung von Schlagworten, können Artikel noch einmal genauer kategorisiert werden." + en: "Articles can be categorized more precisely by assigning keywords." + widget: chipArray + label: + de: Tags / Schlagworte / Labels + en: Tags + addAllowed: true + defaultValue: [] + choices: + endpoint: "tags" + mapping: + id: "name" + name: "name" + params: + sort: "name" diff --git a/api/collections/fields/article/_article.yml b/api/collections/fields/article/_article.yml index 8943471..a8f90fd 100644 --- a/api/collections/fields/article/_article.yml +++ b/api/collections/fields/article/_article.yml @@ -40,43 +40,6 @@ subFields: - { id: "default", name: { de: "Artikel", en: "Article" } } - { id: "news", name: { de: "News", en: "News" } } - !include ../_locale.yml - - name: tags - type: string[] - meta: - helperText: - de: "Über die Zuweisung von Schlagworten, können Artikel kategorisiert werden." - en: "Articles can be categorized by assigning keywords." - widget: chipArray - label: - de: Schlagworte / Tags / Labels - en: Linking Tags - addAllowed: true - defaultValue: [] - choices: - endpoint: "tags" - mapping: - id: "name" - name: "name" - params: - sort: "name" - - name: pages - type: string[] - meta: - helperText: - de: "Zuordnung zu Seiten" - en: "Assignment to Pages" - widget: chipArray - label: - de: Seiten - en: Pages - defaultValue: [] - choices: - endpoint: "content" - mapping: - id: "path" - name: "path" - params: - sort: "path" - name: publish_date type: object meta: @@ -151,7 +114,7 @@ subFields: label: de: Inhalt dieses Artikel en: Article Content - activeTab: 2 + activeTab: 0 subFields: - name: teaser type: string @@ -194,3 +157,4 @@ subFields: - !include _article-layout-margin.yml - !include _article-layout-padding.yml - !include _article-link.yml + - !include _article-assignments.yml diff --git a/api/collections/navigation.yml b/api/collections/navigation.yml index 873fd54..60d1257 100644 --- a/api/collections/navigation.yml +++ b/api/collections/navigation.yml @@ -141,12 +141,23 @@ x-url: &url meta: widget: select label: { de: Zielfenster, en: Target } - defaultValue: "_self" + defaultValue: "default" choices: + - { id: "default", name: "Gleicher Tab oder Seite (ohne Refresh)" } - { id: "_self", name: "Gleicher Tab oder Seite (Standardwert)" } - { id: "_blank", name: "Neuer Tab oder Fenster" } - { id: "_parent", name: "Elternfenster" } + - name: hidden + type: boolean + meta: + label: { de: "Ausgeblendet", en: "Hidden" } + helperText: + { + de: "Definiert, ob der Navigationspunkt in der Navigation angezeigt werden soll oder nicht.", + en: "Defines whether the navigation point should be displayed in the navigation or not.", + } + x-items: &items name: items type: object[] diff --git a/src/components/routes/Content.svelte b/src/components/routes/Content.svelte index 6ef9fe2..1ff3f82 100644 --- a/src/components/routes/Content.svelte +++ b/src/components/routes/Content.svelte @@ -4,7 +4,6 @@ import { generalInfo, currentLang, location } from "../../store" import { navigate } from "svelte-routing" - import Image from "../widgets/Image.svelte" import ArticlesList from "../widgets/ArticlesList.svelte" import ArticleDetails from "../routes/ArticleDetails.svelte" @@ -14,7 +13,6 @@ let content: Content let article: TibiArticle let connectedContentNotFound: boolean = false - $: currentDomain = window.location.protocol + "//" + window.location.host const loadContent = (type?: string) => { // Set default API call filter @@ -29,9 +27,9 @@ } // Changed filter to find simmilar content for changed language - if (type === "changedLanguage" && content?.tags) { + if (type === "changedLanguage" && content?.pages) { filter = { - tags: { $in: content?.tags }, + _id: { $in: content?.pages }, locale: $currentLang, } delete filter.path @@ -118,6 +116,12 @@ content = null article = null + // Update current language when lang in URL not equal to current language + let pathParts = window.location.pathname.split("/") + if (pathParts.length > 3 && $currentLang !== pathParts[1]) { + $currentLang = pathParts[1] + } + if (window.location.pathname.endsWith("/")) { loadContent() } else { diff --git a/src/components/routes/Home.svelte b/src/components/routes/Home.svelte index c6ea7c1..983662c 100644 --- a/src/components/routes/Home.svelte +++ b/src/components/routes/Home.svelte @@ -39,9 +39,9 @@ {/if} - + - + diff --git a/src/components/widgets/ArticlesList.svelte b/src/components/widgets/ArticlesList.svelte index b2bedbc..4a550f6 100644 --- a/src/components/widgets/ArticlesList.svelte +++ b/src/components/widgets/ArticlesList.svelte @@ -5,6 +5,7 @@ import Article from "../widgets/Article.svelte" export let tags: string[] = null + export let pages: string[] = null export let path: string = null let articleEntries: CollectionEntry[] = [] @@ -15,11 +16,15 @@ } if (tags && tags?.length) { - filter["article.general.tags"] = { $in: tags } + filter["article.assignments.tags"] = { $in: tags } + } + + if (pages && pages?.length) { + filter["article.assignments.pages"] = { $in: pages } } if (path) { - filter["article.general.pages"] = { $in: [path] } + filter["article.assignments.pages"] = { $in: [path] } } getArticles("articles", { filter }).then((response) => { diff --git a/src/components/widgets/Navigation.svelte b/src/components/widgets/Navigation.svelte index e830445..1de82da 100644 --- a/src/components/widgets/Navigation.svelte +++ b/src/components/widgets/Navigation.svelte @@ -3,7 +3,7 @@ import Icon from "mdi-svelte" import { mdiMenu } from "@mdi/js" - import { links } from "svelte-routing" + import { links, link } from "svelte-routing" import { navigations, currentLang, location } from "../../store" import LanguageChooser from "./LanguageChooser.svelte" @@ -28,21 +28,33 @@ {#if navigation} @@ -54,29 +66,41 @@ diff --git a/types/global.d.ts b/types/global.d.ts index 1edebed..a0ca068 100644 --- a/types/global.d.ts +++ b/types/global.d.ts @@ -166,6 +166,7 @@ interface NavigationItem { url: { url: string target: string + hidden: boolean } } }