forked from cms/tibi-svelte-starter
Article-Collection etwas aufgeräumt und in einzelne Files ausgelagert.
This commit is contained in:
parent
de6968f3d8
commit
9cf3a814e3
25
api/collections/fields/_article-attachments.yml
Normal file
25
api/collections/fields/_article-attachments.yml
Normal 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: "" }
|
61
api/collections/fields/_article-layout-margin.yml
Normal file
61
api/collections/fields/_article-layout-margin.yml
Normal 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" }
|
61
api/collections/fields/_article-layout-padding.yml
Normal file
61
api/collections/fields/_article-layout-padding.yml
Normal 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" }
|
28
api/collections/fields/_article-link.yml
Normal file
28
api/collections/fields/_article-link.yml
Normal 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" }
|
34
api/collections/fields/_article-media.yml
Normal file
34
api/collections/fields/_article-media.yml
Normal 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" }
|
@ -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
|
||||
|
@ -217,21 +217,16 @@ export const getGeneralInformation = async (): Promise<GeneralInfo[]> => {
|
||||
}
|
||||
}
|
||||
|
||||
export const getArticles = async (
|
||||
collectionName: string,
|
||||
filter: APIParams,
|
||||
params?: APIParams
|
||||
): Promise<TibiArticle[]> => {
|
||||
export const getArticles = async (collectionName: string, apiParams: APIParams): Promise<TibiArticle[]> => {
|
||||
try {
|
||||
let response = await api<TibiArticle[]>(collectionName, {
|
||||
method: "get",
|
||||
offset: 0,
|
||||
params,
|
||||
filter: {
|
||||
"article.general.public": true,
|
||||
...filter,
|
||||
},
|
||||
sort: "article.general.sort",
|
||||
...apiParams,
|
||||
})
|
||||
return response.data
|
||||
} catch (e) {
|
||||
|
24
src/components/routes/ArticleDetails.svelte
Normal file
24
src/components/routes/ArticleDetails.svelte
Normal 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>
|
@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import * as animateScroll from "svelte-scrollto"
|
||||
|
||||
import { generalInfo, currentLang } from "../../store"
|
||||
import { currentLang } from "../../store"
|
||||
import { getArticles } from "../../api"
|
||||
|
||||
import GoogleMaps from "../widgets/GoogleMaps.svelte"
|
||||
@ -15,7 +15,9 @@
|
||||
|
||||
$: if ($currentLang) {
|
||||
getArticles("articles", {
|
||||
"article.general.locale": $currentLang,
|
||||
filter: {
|
||||
"article.general.locale": $currentLang,
|
||||
},
|
||||
}).then((response) => {
|
||||
articleEntries = response
|
||||
})
|
||||
|
45
types/global.d.ts
vendored
45
types/global.d.ts
vendored
@ -72,11 +72,54 @@ interface GeneralInfo {
|
||||
|
||||
interface TibiArticle {
|
||||
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
|
||||
updateTime?: string
|
||||
}
|
||||
|
||||
interface TibiArticleMediaFile {
|
||||
title: string
|
||||
id: string
|
||||
file: File
|
||||
}
|
||||
|
||||
interface TibiArticleAttachmentFile {
|
||||
title: string
|
||||
alternateText: string
|
||||
id: string
|
||||
file: File
|
||||
caption: string
|
||||
}
|
||||
|
||||
interface TibiArticleImage {
|
||||
id: string
|
||||
title: string
|
||||
|
Loading…
Reference in New Issue
Block a user