Article-Collection etwas aufgeräumt und in einzelne Files ausgelagert.

This commit is contained in:
Mario Linz 2022-06-09 14:24:32 +02:00
parent de6968f3d8
commit 9cf3a814e3
10 changed files with 290 additions and 221 deletions

View File

@ -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: "" }

View File

@ -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" }

View File

@ -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" }

View File

@ -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" }

View File

@ -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" }

View File

@ -5,7 +5,7 @@ meta:
label: label:
de: Einstellungen zum Artikel de: Einstellungen zum Artikel
en: Article Setings en: Article Setings
activeTab: 0 activeTab: 1
subFields: subFields:
- name: general - name: general
type: object type: object
@ -51,7 +51,7 @@ subFields:
de: Datum (bis) de: Datum (bis)
en: Date (until) en: Date (until)
- name: interval - name: interval
type: string type: number
meta: meta:
inputProps: inputProps:
placeholder: 60000 placeholder: 60000
@ -131,65 +131,8 @@ subFields:
meta: meta:
widget: richtext widget: richtext
label: { de: "Detail-Text des Artikel", en: "Article Detail Text" } label: { de: "Detail-Text des Artikel", en: "Article Detail Text" }
- name: media - !include _article-media.yml
type: object - !include _article-attachments.yml
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: "" }
- name: layout - name: layout
type: object type: object
meta: meta:
@ -213,153 +156,6 @@ subFields:
meta: meta:
widget: tabs widget: tabs
subFields: subFields:
- name: margin - !include _article-layout-margin.yml
type: object - !include _article-layout-padding.yml
meta: - !include _article-link.yml
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" }

View File

@ -217,21 +217,16 @@ export const getGeneralInformation = async (): Promise<GeneralInfo[]> => {
} }
} }
export const getArticles = async ( export const getArticles = async (collectionName: string, apiParams: APIParams): Promise<TibiArticle[]> => {
collectionName: string,
filter: APIParams,
params?: APIParams
): Promise<TibiArticle[]> => {
try { try {
let response = await api<TibiArticle[]>(collectionName, { let response = await api<TibiArticle[]>(collectionName, {
method: "get", method: "get",
offset: 0, offset: 0,
params,
filter: { filter: {
"article.general.public": true, "article.general.public": true,
...filter,
}, },
sort: "article.general.sort", sort: "article.general.sort",
...apiParams,
}) })
return response.data return response.data
} catch (e) { } catch (e) {

View File

@ -0,0 +1,24 @@
<script lang="ts">
import { currentLang } from "../../store"
import { getArticles } from "../../api"
// import Article from "../widgets/Article.svelte"
$: if ($currentLang) {
getArticles("articles", {
filter: {
"article.general.locale": $currentLang,
},
}).then((response) => {
console.log(response)
})
}
</script>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>ARTICLE DETAILS</h1>
</div>
</div>
</div>

View File

@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import * as animateScroll from "svelte-scrollto" import * as animateScroll from "svelte-scrollto"
import { generalInfo, currentLang } from "../../store" import { currentLang } from "../../store"
import { getArticles } from "../../api" import { getArticles } from "../../api"
import GoogleMaps from "../widgets/GoogleMaps.svelte" import GoogleMaps from "../widgets/GoogleMaps.svelte"
@ -15,7 +15,9 @@
$: if ($currentLang) { $: if ($currentLang) {
getArticles("articles", { getArticles("articles", {
filter: {
"article.general.locale": $currentLang, "article.general.locale": $currentLang,
},
}).then((response) => { }).then((response) => {
articleEntries = response articleEntries = response
}) })

45
types/global.d.ts vendored
View File

@ -72,11 +72,54 @@ interface GeneralInfo {
interface TibiArticle { interface TibiArticle {
id: string id: string
article: any article: {
general: {
public: boolean
locale: string
publish_date: {
from: string
until: string
interval: number
}
tags: string[]
sort: number
}
content: {
slug: string
title: string
subtitle: string
types: {
teaser: string
details: string
media: {
files: TibiArticleMediaFile[]
}
attachments: {
files: TibiArticleAttachmentFile[]
}
}
}
layout: {}
link: {}
}
insertTime?: string insertTime?: string
updateTime?: string updateTime?: string
} }
interface TibiArticleMediaFile {
title: string
id: string
file: File
}
interface TibiArticleAttachmentFile {
title: string
alternateText: string
id: string
file: File
caption: string
}
interface TibiArticleImage { interface TibiArticleImage {
id: string id: string
title: string title: string