From d960250b1b7a84de0405b0566b44bb3378db9ecb Mon Sep 17 00:00:00 2001
From: ManUtopiK <emmanuel.salomon@gmail.com>
Date: Fri, 10 Dec 2021 02:04:38 +0100
Subject: [PATCH] chore: map footer column to settings

---
 components/layout/LayoutFooter.vue | 52 ++++++++++++++++--------------
 static/admin/config.yml            |  6 ++++
 static/settings/menus.json         | 24 +++-----------
 3 files changed, 39 insertions(+), 43 deletions(-)

diff --git a/components/layout/LayoutFooter.vue b/components/layout/LayoutFooter.vue
index 450f3299..ff69c0ab 100644
--- a/components/layout/LayoutFooter.vue
+++ b/components/layout/LayoutFooter.vue
@@ -1,6 +1,16 @@
 <template>
   <div
-    class="flex flex-wrap justify-center bg-gradient-to-r from-purple-600 to-purple-400 py-6 text-white z-10 dark:from-purple-900 dark:to-purple-700 dark:text-gray-100"
+    class="
+      flex flex-wrap
+      justify-center
+      bg-gradient-to-r
+      from-purple-600
+      to-purple-400
+      py-6
+      text-white
+      z-10
+      dark:from-purple-900 dark:to-purple-700 dark:text-gray-100
+    "
   >
     <div class="container">
       <div class="flex flex-wrap mb-4 w-full">
@@ -30,32 +40,24 @@
         </div>
 
         <div
-          class="w-full flex flex-col pl-0 sm:w-1/2 sm:items-start sm:pl-8 md:justify-around md:flex-row"
+          class="
+            w-full
+            flex flex-col
+            pl-0
+            sm:w-1/2 sm:items-start sm:pl-8
+            md:justify-around md:flex-row
+          "
         >
-          <div>
-            <h3 class="text-3xl py-4">Sections</h3>
-            <ul>
-              <li>
-                <nuxt-link class="hover:underline" to="/blog">Blog</nuxt-link>
-              </li>
-              <li>
-                <nuxt-link class="hover:underline" to="/ressources">
-                  Ressources
-                </nuxt-link>
-              </li>
-              <li>
-                <nuxt-link class="hover:underline" to="/faq">FAQ</nuxt-link>
-              </li>
-              <li>
-                <nuxt-link class="hover:underline" to="/lexique">
-                  Lexique
-                </nuxt-link>
+          <div v-for="(column, index) of menuFooter" :key="index">
+            <h3 class="text-3xl py-4">{{ column.title }}</h3>
+            <ul v-if="column.type === 'column'">
+              <li v-for="(menu, i) of column.menus" :key="i">
+                <nuxt-link class="hover:underline" :to="menu.url">{{
+                  menu.title
+                }}</nuxt-link>
               </li>
             </ul>
-          </div>
-          <div>
-            <h3 class="text-3xl py-4">Ressources</h3>
-            <ul>
+            <ul v-if="column.type === 'ressources'">
               <li v-for="category in categories" :key="category.title">
                 <nuxt-link
                   class="hover:underline"
@@ -76,11 +78,13 @@
 </template>
 
 <script>
+import menus from '~/static/settings/menus.json'
 import categories from '~/static/settings/categories.json'
 
 export default {
   data() {
     return {
+      menuFooter: menus.menu_footer,
       categories: categories.ressources,
     }
   },
diff --git a/static/admin/config.yml b/static/admin/config.yml
index 654bc122..b2cfd812 100644
--- a/static/admin/config.yml
+++ b/static/admin/config.yml
@@ -161,6 +161,12 @@ collections:
                       - { label: Titre, name: title }
                       - { name: url }
                       - { label: Icône, name: icon, required: false }
+              - label: Ressources
+                name: ressources
+                widget: object
+                summary: "{{fields.title}}"
+                fields:
+                  - { label: Titre, name: title }
       - name: general
         label: Général
         file: static/settings/globals.json
diff --git a/static/settings/menus.json b/static/settings/menus.json
index d8cc1db7..ee0ee7ff 100644
--- a/static/settings/menus.json
+++ b/static/settings/menus.json
@@ -23,8 +23,8 @@
       "title": "Sections",
       "menus": [
         {
-          "title": "Blog",
-          "url": "/blog"
+          "title": "Ressources",
+          "url": "/ressources"
         },
         {
           "title": "FAQ",
@@ -37,22 +37,8 @@
       ]
     },
     {
-      "type": "column",
-      "title": "Ressources",
-      "menus": [
-        {
-          "title": "Sites web",
-          "url": "/ressources?cat=website"
-        },
-        {
-          "title": "Vidéos",
-          "url": "/ressources?cat=video"
-        },
-        {
-          "title": "Applications",
-          "url": "/ressources?cat=app"
-        }
-      ]
+      "type": "ressources",
+      "title": "Ressources"
     }
   ]
-}
\ No newline at end of file
+}
-- 
GitLab