From 75534213e8aa3d99bdf1264ef1cff9c543c47fb9 Mon Sep 17 00:00:00 2001
From: Mario Linz <mario@webmakers.de>
Date: Thu, 14 Apr 2022 12:23:10 +0200
Subject: [PATCH] =?UTF-8?q?Erste=20Collections=20f=C3=BCr=20eine=20Media-L?=
 =?UTF-8?q?ibrary.=20Weitere=20Collections=20f=C3=BCr=20sp=C3=A4tere=20neu?=
 =?UTF-8?q?e=20Projekte=20hinzugef=C3=BCgt.=20(alles=20WorkInProgress)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 api/collections/_article.yml     | 264 +++++++++++++++++--------------
 api/collections/articles.yml     |   8 +-
 api/collections/mediaLibrary.yml |  40 ++++-
 api/collections/tags.yml         |  86 ++++++++++
 api/config.yml                   |   1 +
 5 files changed, 271 insertions(+), 128 deletions(-)
 create mode 100644 api/collections/tags.yml

diff --git a/api/collections/_article.yml b/api/collections/_article.yml
index ce61e62..c8a098b 100644
--- a/api/collections/_article.yml
+++ b/api/collections/_article.yml
@@ -26,7 +26,7 @@ subFields:
           - name: publish_date
             type: object
             meta:
-                label: 
+                label:
                     de: Datum der Veröffentlichung
                     en: Release Date
                 css: "grid grid-50"
@@ -35,7 +35,7 @@ subFields:
                   type: date
                   meta:
                       inputProps:
-                        type: "datetime-local"
+                          type: "datetime-local"
                       label:
                           de: Datum (ab)
                           en: Date (from)
@@ -43,7 +43,7 @@ subFields:
                   type: date
                   meta:
                       inputProps:
-                        type: "datetime-local"
+                          type: "datetime-local"
                       label:
                           de: Datum (bis)
                           en: Date (until)
@@ -181,137 +181,159 @@ subFields:
                     en: Appearance
                 defaultValue: ["_self"]
                 choices:
-                    - { id: "top", name: { de: "Artikelbild oben (volle Breite)", en: "Article picture top (full width)" } }
-                    - { id: "right", name: { de: "Artikelbild rechts (volle Höhe)", en: "Article picture right (full height)" } }
-                    - { id: "bottom", name: { de: "Artikelbild unten (volle Breite)", en: "Article picture left (full width)" } }
-                    - { id: "left", name: { de: "Artikelbild links (volle Höhe)", en: "Article picture left (full height)" } }
-                    - { id: "after-teaser", name: { de: "Artikelbild unter Teaser (volle Breite)" , en: "Article picture under teaser (full width)" } }
+                    - {
+                          id: "top",
+                          name: { de: "Artikelbild oben (volle Breite)", en: "Article picture top (full width)" },
+                      }
+                    - {
+                          id: "right",
+                          name: { de: "Artikelbild rechts (volle Höhe)", en: "Article picture right (full height)" },
+                      }
+                    - {
+                          id: "bottom",
+                          name: { de: "Artikelbild unten (volle Breite)", en: "Article picture left (full width)" },
+                      }
+                    - {
+                          id: "left",
+                          name: { de: "Artikelbild links (volle Höhe)", en: "Article picture left (full height)" },
+                      }
+                    - {
+                          id: "after-teaser",
+                          name:
+                              {
+                                  de: "Artikelbild unter Teaser (volle Breite)",
+                                  en: "Article picture under teaser (full width)",
+                              },
+                      }
                     - { id: "top-left", name: { de: "Artikelbild oben links", en: "Article picture above left" } }
                     - { id: "top-right", name: { de: "Artikelbild oben rechts", en: "Article picture above right" } }
                     - { id: "bottom-left", name: { de: "Artikelbild unten links", en: "Article picture below left" } }
-                    - { id: "bottom-right", name: { de: "Artikelbild unten rechts", en: "Article picture below right" } }
+                    - {
+                          id: "bottom-right",
+                          name: { de: "Artikelbild unten rechts", en: "Article picture below right" },
+                      }
           - 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: Oben
-                        en: Top
-                    choices:
-                        - { id: "", name: "Kein Abstand" }
-                        - { 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: Rechts
-                        en: Right
-                    choices:
-                        - { id: "", name: "Kein Abstand" }
-                        - { 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: Unten
-                        en: Bottom
-                    choices:
-                        - { id: "", name: "Kein Abstand" }
-                        - { 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: Links
-                        en: Left
-                    choices:
-                        - { id: "", name: "Kein Abstand" }
-                        - { 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: top
+                  type: string
+                  meta:
+                      widget: select
+                      label:
+                          de: Oben
+                          en: Top
+                      choices:
+                          - { id: "", name: "Kein Abstand" }
+                          - { 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: Rechts
+                          en: Right
+                      choices:
+                          - { id: "", name: "Kein Abstand" }
+                          - { 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: Unten
+                          en: Bottom
+                      choices:
+                          - { id: "", name: "Kein Abstand" }
+                          - { 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: Links
+                          en: Left
+                      choices:
+                          - { id: "", name: "Kein Abstand" }
+                          - { 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: Oben
-                        en: Top
-                    choices:
-                        - { id: "", name: "Kein Abstand" }
-                        - { 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: Rechts
-                        en: Right
-                    choices:
-                        - { id: "", name: "Kein Abstand" }
-                        - { 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: Unten
-                        en: Bottom
-                    choices:
-                        - { id: "", name: "Kein Abstand" }
-                        - { 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: Links
-                        en: Left
-                    choices:
-                        - { id: "", name: "Kein Abstand" }
-                        - { 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: top
+                  type: string
+                  meta:
+                      widget: select
+                      label:
+                          de: Oben
+                          en: Top
+                      choices:
+                          - { id: "", name: "Kein Abstand" }
+                          - { 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: Rechts
+                          en: Right
+                      choices:
+                          - { id: "", name: "Kein Abstand" }
+                          - { 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: Unten
+                          en: Bottom
+                      choices:
+                          - { id: "", name: "Kein Abstand" }
+                          - { 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: Links
+                          en: Left
+                      choices:
+                          - { id: "", name: "Kein Abstand" }
+                          - { 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:
diff --git a/api/collections/articles.yml b/api/collections/articles.yml
index 7e8678b..e5f0b16 100644
--- a/api/collections/articles.yml
+++ b/api/collections/articles.yml
@@ -28,8 +28,12 @@ meta:
           mediaQuery: "(min-width:600px)"
           columns:
               - article.general.public
-              - article.content.title
-              - article.general.position
+              - label: { de: "Titel", en: "Title" }
+                source: article.content.title
+                filter: true
+              - label: { de: "Position", en: "Position" }
+                source: article.general.position
+                filter: true
               - article.general.sort
 
 imageFilter:
diff --git a/api/collections/mediaLibrary.yml b/api/collections/mediaLibrary.yml
index ecdc780..8f4baf5 100644
--- a/api/collections/mediaLibrary.yml
+++ b/api/collections/mediaLibrary.yml
@@ -24,6 +24,16 @@ meta:
           columns:
               - file
               - title
+          list:
+              columns:
+                  - file
+                  - title
+          tile:
+              width: 200px
+              height: auto
+              grid:
+                  - { source: file }
+                  - { source: title, width: 50%, label: "Titel" }
 
 imageFilter:
     xs:
@@ -80,12 +90,32 @@ permissions:
 
 # Feldliste der Kollektion
 fields:
-    - name: file
-      type: file
-      meta:
-          widget: mediaLibraryFile
-          label: { de: "Datei", en: "File" }
     - name: title
       type: string
       meta:
           label: { de: "Titel des Dokuments/Bild", en: "Document/Image Title" }
+          filter: true
+    - name: tags
+      type: string[]
+      meta:
+          widget: chipArray
+          label:
+              de: Tags / Labels
+              en: Tags / Labels
+          #   allowedAddEntry:
+          #       collection: "tags"
+          autocomplete: true
+          choices:
+              endpoint: "tags"
+              mapping:
+                  id: "id"
+                  name: "name"
+              params:
+                  count: 1
+                  sort: "ASC"
+                  query: ""
+    - name: file
+      type: file
+      meta:
+          widget: mediaFile
+          label: { de: "Datei", en: "File" }
diff --git a/api/collections/tags.yml b/api/collections/tags.yml
new file mode 100644
index 0000000..68dd46d
--- /dev/null
+++ b/api/collections/tags.yml
@@ -0,0 +1,86 @@
+###############################################################
+# Media Library
+###############################################################
+
+# Name/URL-Anteil der Kollektion
+name: tags
+uploadPath: ../media/tags
+
+# Metaangaben zur Kollektion welche in der Admin-UI verwendet werden können
+meta:
+    # Navigationseintrag in der Admin-UI
+    label: { de: "Tags / Labels", en: "Tags / Labels" }
+    # Icon (Material UI) für den Navigationseintrag
+    muiIcon: tag
+    # Identifizierung eines Eintrags für z.B. Select-Boxen in der Admin-UI
+    rowIdentTpl: { twig: "{{ path }}" }
+    # Standardsortierung der Liste
+    defaultSort: { field: "tag", order: "ASC" }
+    # Admin-Backend Ansichten
+    defaultImageFilter: s
+    views:
+        - type: table
+          mediaQuery: "(min-width:0px)"
+          columns:
+              - name
+
+imageFilter:
+    xs:
+        - fit: true
+          height: 90
+          width: 90
+          resampling: lanczos
+          quality: 60
+    s:
+        - fit: true
+          height: 300
+          width: 300
+          resampling: lanczos
+          quality: 60
+    m:
+        - fit: true
+          height: 600
+          width: 600
+          resampling: lanczos
+          quality: 60
+    l:
+        - fit: true
+          height: 1200
+          width: 1200
+          resampling: lanczos
+          quality: 60
+    xl:
+        - fit: true
+          height: 2000
+          width: 2000
+          resampling: lanczos
+          quality: 60
+
+permissions:
+    public:
+        methods:
+            get: true
+            post: false
+            put: false
+            delete: false
+    user:
+        methods:
+            get: true
+            post: false
+            put: false
+            delete: false
+    # token als Zusatzsicherung gegen Spam, mehr siehe Hook
+    "token:${PUBLIC_TOKEN}":
+        methods:
+            get: false
+            post: false
+            put: false
+            delete: false
+
+# Feldliste der Kollektion
+fields:
+    - name: name
+      type: string
+      meta:
+          label: { de: "Name des Tags", en: "Tag Name" }
+          filter: true
diff --git a/api/config.yml b/api/config.yml
index cfab0c0..533be08 100644
--- a/api/config.yml
+++ b/api/config.yml
@@ -9,6 +9,7 @@ meta:
 collections:
     - !include collections/general.yml
     - !include collections/mediaLibrary.yml
+    - !include collections/tags.yml
     - !include collections/articles.yml
     - !include collections/content.yml
     - !include collections/contact_form.yml