From 9cf3a814e317278d2e7f375f8e09796f51f1bc26 Mon Sep 17 00:00:00 2001 From: Mario Linz Date: Thu, 9 Jun 2022 14:24:32 +0200 Subject: [PATCH] =?UTF-8?q?Article-Collection=20etwas=20aufger=C3=A4umt=20?= =?UTF-8?q?und=20in=20einzelne=20Files=20ausgelagert.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fields/_article-attachments.yml | 25 ++ .../fields/_article-layout-margin.yml | 61 +++++ .../fields/_article-layout-padding.yml | 61 +++++ api/collections/fields/_article-link.yml | 28 +++ api/collections/fields/_article-media.yml | 34 +++ api/collections/fields/_article.yml | 218 +----------------- src/api.ts | 9 +- src/components/routes/ArticleDetails.svelte | 24 ++ src/components/routes/Home.svelte | 6 +- types/global.d.ts | 45 +++- 10 files changed, 290 insertions(+), 221 deletions(-) create mode 100644 api/collections/fields/_article-attachments.yml create mode 100644 api/collections/fields/_article-layout-margin.yml create mode 100644 api/collections/fields/_article-layout-padding.yml create mode 100644 api/collections/fields/_article-link.yml create mode 100644 api/collections/fields/_article-media.yml create mode 100644 src/components/routes/ArticleDetails.svelte diff --git a/api/collections/fields/_article-attachments.yml b/api/collections/fields/_article-attachments.yml new file mode 100644 index 0000000..915d18c --- /dev/null +++ b/api/collections/fields/_article-attachments.yml @@ -0,0 +1,25 @@ +name: attachments +type: object +meta: + label: + de: Anhänge / Downloads + en: Attachments / Downloads + css: +subFields: + - name: files + type: object[] + meta: + label: { de: "Anhänge", en: "Attachments" } + subFields: + - name: title + type: string + meta: + label: { de: "Datei-Titel", en: "File Title" } + - name: id + type: string + meta: + label: { de: "Technischer Name / ID", en: "Technical name / ID" } + - name: file + type: file + meta: + label: { de: "", en: "" } diff --git a/api/collections/fields/_article-layout-margin.yml b/api/collections/fields/_article-layout-margin.yml new file mode 100644 index 0000000..011818d --- /dev/null +++ b/api/collections/fields/_article-layout-margin.yml @@ -0,0 +1,61 @@ +name: margin +type: object +meta: + label: { de: "Abstand nach außen (Margin)", en: "Distance to the outside (Margin)" } +subFields: + - name: top + type: string + meta: + widget: select + label: + de: Abstand nach Oben + en: Margin Top + choices: + - { id: "", name: "-" } + - { id: "mt-xs", name: "Sehr kleiner Abstand" } + - { id: "mt-sm", name: "Kleiner Abstand" } + - { id: "mt-md", name: "Normal" } + - { id: "mt-lg", name: "Großer Abstand" } + - { id: "mt-xl", name: "Sehr großer Abstand" } + - name: right + type: string + meta: + widget: select + label: + de: Abstand nach Rechts + en: Margin Right + choices: + - { id: "", name: "-" } + - { id: "mr-xs", name: "Sehr kleiner Abstand" } + - { id: "mr-sm", name: "Kleiner Abstand" } + - { id: "mr-md", name: "Normal" } + - { id: "mr-lg", name: "Großer Abstand" } + - { id: "mr-xl", name: "Sehr großer Abstand" } + - name: bottom + type: string + meta: + widget: select + label: + de: Abstand nach Unten + en: Margin Bottom + choices: + - { id: "", name: "-" } + - { id: "mb-xs", name: "Sehr kleiner Abstand" } + - { id: "mb-sm", name: "Kleiner Abstand" } + - { id: "mb-md", name: "Normal" } + - { id: "mb-lg", name: "Großer Abstand" } + - { id: "mb-xl", name: "Sehr großer Abstand" } + - name: left + type: string + meta: + widget: select + label: + de: Abstand nach Links + en: Margin Left + choices: + - { id: "", name: "-" } + - { id: "ml-xs", name: "Sehr kleiner Abstand" } + - { id: "ml-sm", name: "Kleiner Abstand" } + - { id: "ml-md", name: "Normal" } + - { id: "ml-lg", name: "Großer Abstand" } + - { id: "ml-xl", name: "Sehr großer Abstand" } diff --git a/api/collections/fields/_article-layout-padding.yml b/api/collections/fields/_article-layout-padding.yml new file mode 100644 index 0000000..20d8dd5 --- /dev/null +++ b/api/collections/fields/_article-layout-padding.yml @@ -0,0 +1,61 @@ +name: padding +type: object +meta: + label: { de: "Abstand nach innen (Padding)", en: "Distance inside (Padding)" } +subFields: + - name: top + type: string + meta: + widget: select + label: + de: Innenabstand nach Oben + en: Padding Top + choices: + - { id: "", name: "-" } + - { id: "pt-xs", name: "Sehr kleiner Abstand" } + - { id: "pt-sm", name: "Kleiner Abstand" } + - { id: "pt-md", name: "Normal" } + - { id: "pt-lg", name: "Großer Abstand" } + - { id: "pt-xl", name: "Sehr großer Abstand" } + - name: right + type: string + meta: + widget: select + label: + de: Innenabstand nach Rechts + en: Padding Right + choices: + - { id: "", name: "-" } + - { id: "pr-xs", name: "Sehr kleiner Abstand" } + - { id: "pr-sm", name: "Kleiner Abstand" } + - { id: "pr-md", name: "Normal" } + - { id: "pr-lg", name: "Großer Abstand" } + - { id: "pr-xl", name: "Sehr großer Abstand" } + - name: bottom + type: string + meta: + widget: select + label: + de: Innenabstand nach Unten + en: Padding Bottom + choices: + - { id: "", name: "-" } + - { id: "pb-xs", name: "Sehr kleiner Abstand" } + - { id: "pb-sm", name: "Kleiner Abstand" } + - { id: "pb-md", name: "Normal" } + - { id: "pb-lg", name: "Großer Abstand" } + - { id: "pb-xl", name: "Sehr großer Abstand" } + - name: left + type: string + meta: + widget: select + label: + de: Innenabstand nach Links + en: Padding Left + choices: + - { id: "", name: "-" } + - { id: "pl-xs", name: "Sehr kleiner Abstand" } + - { id: "pl-sm", name: "Kleiner Abstand" } + - { id: "pl-md", name: "Normal" } + - { id: "pl-lg", name: "Großer Abstand" } + - { id: "pl-xl", name: "Sehr großer Abstand" } diff --git a/api/collections/fields/_article-link.yml b/api/collections/fields/_article-link.yml new file mode 100644 index 0000000..159bf21 --- /dev/null +++ b/api/collections/fields/_article-link.yml @@ -0,0 +1,28 @@ +name: link +type: object +meta: + label: + de: Verlinkung + en: Link + css: +subFields: + - name: url + type: string + meta: + label: { de: "Ziel-URL", en: "Target URL" } + - name: text + type: string + meta: + label: { de: "Link-Beschriftung", en: "Link-Text" } + - name: target + type: string + meta: + widget: select + label: + de: Zielfenster + en: Target + defaultValue: ["_self"] + choices: + - { id: "_self", name: "(Standardwert) gleicher Tab oder Seite" } + - { id: "_blank", name: "Neuer Tab oder Fenster" } + - { id: "_parent", name: "Elternfenster" } diff --git a/api/collections/fields/_article-media.yml b/api/collections/fields/_article-media.yml new file mode 100644 index 0000000..ea7fee8 --- /dev/null +++ b/api/collections/fields/_article-media.yml @@ -0,0 +1,34 @@ +name: media +type: object +meta: + label: + de: Medien + en: Media +subFields: + - name: files + type: object[] + meta: + label: { de: "Bilder", en: "Images" } + subFields: + - name: title + type: string + meta: + label: { de: "Datei-Titel", en: "File Title" } + - name: alternateText + type: string + meta: + label: { de: "Alternativer Text", en: "Alternate Text" } + - name: id + type: string + meta: + editableWhileCreating: true + label: { de: "Technischer Name / ID", en: "Technical name / ID" } + - name: file + type: file + meta: + widget: image + label: { de: "Datei", en: "File" } + - name: caption + type: string + meta: + label: { de: "Bildunterschrift", en: "Caption" } diff --git a/api/collections/fields/_article.yml b/api/collections/fields/_article.yml index b6acdba..815a55b 100644 --- a/api/collections/fields/_article.yml +++ b/api/collections/fields/_article.yml @@ -5,7 +5,7 @@ meta: label: de: Einstellungen zum Artikel en: Article Setings - activeTab: 0 + activeTab: 1 subFields: - name: general type: object @@ -51,7 +51,7 @@ subFields: de: Datum (bis) en: Date (until) - name: interval - type: string + type: number meta: inputProps: placeholder: 60000 @@ -131,65 +131,8 @@ subFields: meta: widget: richtext label: { de: "Detail-Text des Artikel", en: "Article Detail Text" } - - name: media - type: object - meta: - label: - de: Medien - en: Media - subFields: - - name: files - type: object[] - meta: - label: { de: "Bilder", en: "Images" } - subFields: - - name: title - type: string - meta: - label: { de: "Datei-Titel", en: "File Title" } - - name: alternateText - type: string - meta: - label: { de: "Alternativer Text", en: "Alternate Text" } - - name: id - type: string - meta: - editableWhileCreating: true - label: { de: "Technischer Name / ID", en: "Technical name / ID" } - - name: file - type: file - meta: - widget: image - label: { de: "Datei", en: "File" } - - name: caption - type: string - meta: - label: { de: "Bildunterschrift", en: "Caption" } - - name: attachments - type: object - meta: - label: - de: Anhänge / Downloads - en: Attachments / Downloads - css: - subFields: - - name: files - type: object[] - meta: - label: { de: "Anhänge", en: "Attachments" } - subFields: - - name: title - type: string - meta: - label: { de: "Datei-Titel", en: "File Title" } - - name: id - type: string - meta: - label: { de: "Technischer Name / ID", en: "Technical name / ID" } - - name: file - type: file - meta: - label: { de: "", en: "" } + - !include _article-media.yml + - !include _article-attachments.yml - name: layout type: object meta: @@ -213,153 +156,6 @@ subFields: meta: widget: tabs subFields: - - name: margin - type: object - meta: - label: { de: "Abstand nach außen (Margin)", en: "Distance to the outside (Margin)" } - subFields: - - name: top - type: string - meta: - widget: select - label: - de: Abstand nach Oben - en: Margin Top - choices: - - { id: "", name: "-" } - - { id: "mt-xs", name: "Sehr kleiner Abstand" } - - { id: "mt-sm", name: "Kleiner Abstand" } - - { id: "mt-md", name: "Normal" } - - { id: "mt-lg", name: "Großer Abstand" } - - { id: "mt-xl", name: "Sehr großer Abstand" } - - name: right - type: string - meta: - widget: select - label: - de: Abstand nach Rechts - en: Margin Right - choices: - - { id: "", name: "-" } - - { id: "mr-xs", name: "Sehr kleiner Abstand" } - - { id: "mr-sm", name: "Kleiner Abstand" } - - { id: "mr-md", name: "Normal" } - - { id: "mr-lg", name: "Großer Abstand" } - - { id: "mr-xl", name: "Sehr großer Abstand" } - - name: bottom - type: string - meta: - widget: select - label: - de: Abstand nach Unten - en: Margin Bottom - choices: - - { id: "", name: "-" } - - { id: "mb-xs", name: "Sehr kleiner Abstand" } - - { id: "mb-sm", name: "Kleiner Abstand" } - - { id: "mb-md", name: "Normal" } - - { id: "mb-lg", name: "Großer Abstand" } - - { id: "mb-xl", name: "Sehr großer Abstand" } - - name: left - type: string - meta: - widget: select - label: - de: Abstand nach Links - en: Margin Left - choices: - - { id: "", name: "-" } - - { id: "ml-xs", name: "Sehr kleiner Abstand" } - - { id: "ml-sm", name: "Kleiner Abstand" } - - { id: "ml-md", name: "Normal" } - - { id: "ml-lg", name: "Großer Abstand" } - - { id: "ml-xl", name: "Sehr großer Abstand" } - - name: padding - type: object - meta: - label: { de: "Abstand nach innen (Padding)", en: "Distance inside (Padding)" } - subFields: - - name: top - type: string - meta: - widget: select - label: - de: Innenabstand nach Oben - en: Padding Top - choices: - - { id: "", name: "-" } - - { id: "pt-xs", name: "Sehr kleiner Abstand" } - - { id: "pt-sm", name: "Kleiner Abstand" } - - { id: "pt-md", name: "Normal" } - - { id: "pt-lg", name: "Großer Abstand" } - - { id: "pt-xl", name: "Sehr großer Abstand" } - - name: right - type: string - meta: - widget: select - label: - de: Innenabstand nach Rechts - en: Padding Right - choices: - - { id: "", name: "-" } - - { id: "pr-xs", name: "Sehr kleiner Abstand" } - - { id: "pr-sm", name: "Kleiner Abstand" } - - { id: "pr-md", name: "Normal" } - - { id: "pr-lg", name: "Großer Abstand" } - - { id: "pr-xl", name: "Sehr großer Abstand" } - - name: bottom - type: string - meta: - widget: select - label: - de: Innenabstand nach Unten - en: Padding Bottom - choices: - - { id: "", name: "-" } - - { id: "pb-xs", name: "Sehr kleiner Abstand" } - - { id: "pb-sm", name: "Kleiner Abstand" } - - { id: "pb-md", name: "Normal" } - - { id: "pb-lg", name: "Großer Abstand" } - - { id: "pb-xl", name: "Sehr großer Abstand" } - - name: left - type: string - meta: - widget: select - label: - de: Innenabstand nach Links - en: Padding Left - choices: - - { id: "", name: "-" } - - { id: "pl-xs", name: "Sehr kleiner Abstand" } - - { id: "pl-sm", name: "Kleiner Abstand" } - - { id: "pl-md", name: "Normal" } - - { id: "pl-lg", name: "Großer Abstand" } - - { id: "pl-xl", name: "Sehr großer Abstand" } - - name: link - type: object - meta: - label: - de: Verlinkung - en: Link - css: - subFields: - - name: url - type: string - meta: - label: { de: "Ziel-URL", en: "Target URL" } - - name: text - type: string - meta: - label: { de: "Link-Beschriftung", en: "Link-Text" } - - name: target - type: string - meta: - widget: select - label: - de: Zielfenster - en: Target - defaultValue: ["_self"] - choices: - - { id: "_self", name: "(Standardwert) gleicher Tab oder Seite" } - - { id: "_blank", name: "Neuer Tab oder Fenster" } - - { id: "_parent", name: "Elternfenster" } + - !include _article-layout-margin.yml + - !include _article-layout-padding.yml + - !include _article-link.yml diff --git a/src/api.ts b/src/api.ts index dc8e668..630355e 100644 --- a/src/api.ts +++ b/src/api.ts @@ -217,21 +217,16 @@ export const getGeneralInformation = async (): Promise => { } } -export const getArticles = async ( - collectionName: string, - filter: APIParams, - params?: APIParams -): Promise => { +export const getArticles = async (collectionName: string, apiParams: APIParams): Promise => { try { let response = await api(collectionName, { method: "get", offset: 0, - params, filter: { "article.general.public": true, - ...filter, }, sort: "article.general.sort", + ...apiParams, }) return response.data } catch (e) { diff --git a/src/components/routes/ArticleDetails.svelte b/src/components/routes/ArticleDetails.svelte new file mode 100644 index 0000000..8f00a73 --- /dev/null +++ b/src/components/routes/ArticleDetails.svelte @@ -0,0 +1,24 @@ + + +
+
+
+

ARTICLE DETAILS

+
+
+
diff --git a/src/components/routes/Home.svelte b/src/components/routes/Home.svelte index 4c5b173..47f1001 100644 --- a/src/components/routes/Home.svelte +++ b/src/components/routes/Home.svelte @@ -1,7 +1,7 @@