This commit is contained in:
Elo1L 2024-03-07 09:29:32 +01:00
parent c6254f291f
commit 7c3b1166ee
4 changed files with 276 additions and 6 deletions

File diff suppressed because one or more lines are too long

View file

@ -14,9 +14,63 @@ media_library:
config:
max_file_size: 1024000
collections:
- name: page principale
icon: homePage
label: Page principale
label_singular: Page principale
create: false
destroy: false
description: >
Créez vos propre pages
folder: content/blog
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
summary_fields:
- title
- date
sortable_fields:
fields:
- title
- date
default:
field: title
view_filters:
filters:
- name: posts-with-index
label: Posts With Index
field: title
pattern: 'This is post #'
- name: posts-without-index
label: Posts Without Index
field: title
pattern: front matter post
view_groups:
groups:
- name: by-year
label: Year
field: date
pattern: '\d{4}'
fields:
- label: Title
name: title
widget: string
- label: Publish Date
name: date
widget: datetime
date_format: yyyy-MM-dd
time_format: 'HH:mm'
format: "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
- label: Cover Image
name: image
widget: image
required: false
- label: Body
name: body
widget: markdown
hint: "*Main* __content__ __*goes*__ [here](https://example.com/)."
- name: pages
#to build a hugo section (look for it)
label: Pages du site
icon: postPage
label_singular: 'Page'
folder: content/pages
#path: '{{slug}}/_index'
@ -51,8 +105,82 @@ collections:
# media_library:
# config:
# multiple: true
- label: 'Configuration'
name: settings
# - name: posts
# icon: postPage
# label: Posts
# label_singular: Post
# description: >
# The description is a great place for tone setting, high level information,
# and editing guidelines that are specific to a collection.
# folder: content/_posts
# slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
# summary_fields:
# - title
# - date
# sortable_fields:
# fields:
# - title
# - date
# default:
# field: title
# create: true
# view_filters:
# filters:
# - name: posts-with-index
# label: Posts With Index
# field: title
# pattern: 'This is post #'
# - name: posts-without-index
# label: Posts Without Index
# field: title
# pattern: front matter post
# - name: draft
# label: Drafts
# field: draft
# pattern: true
# view_groups:
# groups:
# - name: by-year
# label: Year
# field: date
# pattern: '\d{4}'
# - name: draft
# label: Drafts
# field: draft
# fields:
# - label: Title
# name: title
# widget: string
# - label: 'Draft'
# name: 'draft'
# widget: 'boolean'
# default: false
# - label: Publish Date
# name: date
# widget: datetime
# date_format: yyyy-MM-dd
# time_format: 'HH:mm'
# format: "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
# - label: Cover Image
# name: image
# widget: image
# required: false
# - label: Description
# name: description
# widget: text
# - label: Category
# name: category
# widget: string
# - label: Body
# name: body
# widget: markdown
# hint: '*Main* __content__ __*goes*__ [here](https://example.com/).'
# - label: Tags
# name: tags
# widget: list
- name: settings
label: 'Configuration'
icon: settingsPage
files:
- label: 'Configuration du thème'
name: theme settings

View file

@ -9,8 +9,6 @@
<body>
<!-- Include the script that builds the page and powers Static CMS -->
<script src="/admin/static-cms-app.js"></script>
<script>
window.CMS.init();
</script>
<script type="module" src="index.js"></script>
</body>
</html>

144
static/admin/index.js Normal file
View file

@ -0,0 +1,144 @@
const homeSVG = h('svg', {
width: '800px',
height: '800px',
viewBox: '0 0 24 24',
fill: 'none',
xmlns: 'http://www.w3.org/2000/svg'
}, [
h('path', {
d: 'M19 9L19 17C19 18.8856 19 19.8284 18.4142 20.4142C17.8284 21 16.8856 21 15 21L14 21L10 21L9 21C7.11438 21 6.17157 21 5.58579 20.4142C5 19.8284 5 18.8856 5 17L5 9',
stroke: '#FFFFFF',
'stroke-width': '1.5',
'stroke-linejoin': 'round'
}),
h('path', {
d: 'M3 11L7.5 7L10.6713 4.18109C11.429 3.50752 12.571 3.50752 13.3287 4.18109L16.5 7L21 11',
stroke: '#FFFFFF',
'stroke-width': '1.5',
'stroke-linecap': 'round',
'stroke-linejoin': 'round'
}),
h('path', {
d: 'M10 21V17C10 15.8954 10.8954 15 12 15V15C13.1046 15 14 15.8954 14 17V21',
stroke: '#FFFFFF',
'stroke-width': '1.5',
'stroke-linecap': 'round',
'stroke-linejoin': 'round'
})
]);
const menuSVG = h('svg', {
width: '800px',
height: '800px',
viewBox: '0 0 24 24',
fill: 'none',
xmlns: 'http://www.w3.org/2000/svg'
}, [
h('path', {
opacity: '0.4',
d: 'M16.19 2H7.81C4.17 2 2 4.17 2 7.81V16.18C2 19.83 4.17 22 7.81 22H16.18C19.82 22 21.99 19.83 21.99 16.19V7.81C22 4.17 19.83 2 16.19 2Z',
fill: '#FFFFFF'
}),
h('path', {
d: 'M17 8.25H7C6.59 8.25 6.25 7.91 6.25 7.5C6.25 7.09 6.59 6.75 7 6.75H17C17.41 6.75 17.75 7.09 17.75 7.5C17.75 7.91 17.41 8.25 17 8.25Z',
fill: '#FFFFFF'
}),
h('path', {
d: 'M17 12.75H7C6.59 12.75 6.25 12.41 6.25 12C6.25 11.59 6.59 11.25 7 11.25H17C17.41 11.25 17.75 11.59 17.75 12C17.75 12.41 17.41 12.75 17 12.75Z',
fill: '#FFFFFF'
}),
h('path', {
d: 'M17 17.25H7C6.59 17.25 6.25 16.91 6.25 16.5C6.25 16.09 6.59 15.75 7 15.75H17C17.41 15.75 17.75 16.09 17.75 16.5C17.75 16.91 17.41 17.25 17 17.25Z',
fill: '#FFFFFF'
})
]);
const settingsSVG = h('svg', {
width: '800px',
height: '800px',
viewBox: '0 0 24 24',
fill: 'none',
xmlns: 'http://www.w3.org/2000/svg'
}, [
h('circle', {
cx: '12',
cy: '12',
r: '3',
stroke: '#FFFFFF',
'stroke-width': '1.5'
}),
h('path', {
d: 'M13.7654 2.15224C13.3978 2 12.9319 2 12 2C11.0681 2 10.6022 2 10.2346 2.15224C9.74457 2.35523 9.35522 2.74458 9.15223 3.23463C9.05957 3.45834 9.0233 3.7185 9.00911 4.09799C8.98826 4.65568 8.70226 5.17189 8.21894 5.45093C7.73564 5.72996 7.14559 5.71954 6.65219 5.45876C6.31645 5.2813 6.07301 5.18262 5.83294 5.15102C5.30704 5.08178 4.77518 5.22429 4.35436 5.5472C4.03874 5.78938 3.80577 6.1929 3.33983 6.99993C2.87389 7.80697 2.64092 8.21048 2.58899 8.60491C2.51976 9.1308 2.66227 9.66266 2.98518 10.0835C3.13256 10.2756 3.3397 10.437 3.66119 10.639C4.1338 10.936 4.43789 11.4419 4.43786 12C4.43783 12.5581 4.13375 13.0639 3.66118 13.3608C3.33965 13.5629 3.13248 13.7244 2.98508 13.9165C2.66217 14.3373 2.51966 14.8691 2.5889 15.395C2.64082 15.7894 2.87379 16.193 3.33973 17C3.80568 17.807 4.03865 18.2106 4.35426 18.4527C4.77508 18.7756 5.30694 18.9181 5.83284 18.8489C6.07289 18.8173 6.31632 18.7186 6.65204 18.5412C7.14547 18.2804 7.73556 18.27 8.2189 18.549C8.70224 18.8281 8.98826 19.3443 9.00911 19.9021C9.02331 20.2815 9.05957 20.5417 9.15223 20.7654C9.35522 21.2554 9.74457 21.6448 10.2346 21.8478C10.6022 22 11.0681 22 12 22C12.9319 22 13.3978 22 13.7654 21.8478C14.2554 21.6448 14.6448 21.2554 14.8477 20.7654C14.9404 20.5417 14.9767 20.2815 14.9909 19.902C15.0117 19.3443 15.2977 18.8281 15.781 18.549C16.2643 18.2699 16.8544 18.2804 17.3479 18.5412C17.6836 18.7186 17.927 18.8172 18.167 18.8488C18.6929 18.9181 19.2248 18.7756 19.6456 18.4527C19.9612 18.2105 20.1942 17.807 20.6601 16.9999C21.1261 16.1929 21.3591 15.7894 21.411 15.395C21.4802 14.8691 21.3377 14.3372 21.0148 13.9164C20.8674 13.7243 20.6602 13.5628 20.3387 13.3608C19.8662 13.0639 19.5621 12.558 19.5621 11.9999C19.5621 11.4418 19.8662 10.9361 20.3387 10.6392C20.6603 10.4371 20.8675 10.2757 21.0149 10.0835C21.3378 9.66273 21.4803 9.13087 21.4111 8.60497C21.3592 8.21055 21.1262 7.80703 20.6602 7C20.1943 6.19297 19.9613 5.78945 19.6457 5.54727C19.2249 5.22436 18.693 5.08185 18.1671 5.15109C17.9271 5.18269 17.6837 5.28136 17.3479 5.4588C16.8545 5.71959 16.2644 5.73002 15.7811 5.45096C15.2977 5.17191 15.0117 4.65566 14.9909 4.09794C14.9767 3.71848 14.9404 3.45833 14.8477 3.23463C14.6448 2.74458 14.2554 2.35523 13.7654 2.15224Z',
stroke: '#FFFFFF',
'stroke-width': '1.5'
})
]);
const postSVG = h('svg', {
width: '800px',
height: '800px',
viewBox: '0 0 24 24',
fill: 'none',
xmlns: 'http://www.w3.org/2000/svg'
}, [
h('path', {
d: 'M2 5C2 3.34315 3.34315 2 5 2H19C20.6569 2 22 3.34315 22 5V19C22 20.6569 20.6569 22 19 22H5C3.34315 22 2 20.6569 2 19V5ZM5 4C4.44772 4 4 4.44772 4 5V10H20V5C20 4.44772 19.5523 4 19 4H5ZM4 12V19C4 19.5523 4.44772 20 5 20H19C19.5523 20 20 19.5523 20 19V12H4ZM14 13C14.2652 13 14.5196 13.1054 14.7071 13.2929L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L14 15.4142L11.7071 17.7071L10.7071 18.7071C10.3166 19.0976 9.68342 19.0976 9.29289 18.7071C8.90237 18.3166 8.90237 17.6834 9.29289 17.2929L9.58579 17L9 16.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L8.29289 14.2929C8.48043 14.1054 8.73478 14 9 14C9.26522 14 9.51957 14.1054 9.70711 14.2929L11 15.5858L13.2929 13.2929C13.4804 13.1054 13.7348 13 14 13ZM11 7C11 6.44772 11.4477 6 12 6H17C17.5523 6 18 6.44772 18 7C18 7.55228 17.5523 8 17 8H12C11.4477 8 11 7.55228 11 7ZM7 8.75C7.9665 8.75 8.75 7.9665 8.75 7C8.75 6.0335 7.9665 5.25 7 5.25C6.0335 5.25 5.25 6.0335 5.25 7C5.25 7.9665 6.0335 8.75 7 8.75Z',
fill: '#FFFFFF',
'stroke-width': '0.5'
})
]);
const helpSVG = h('svg', {
width: '800px',
height: '800px',
viewBox: '0 0 24 24',
fill: 'none',
xmlns: 'http://www.w3.org/2000/svg'
}, [
h('path', {
d: 'M12 17H12.01M12 14C12.8906 12.0938 15 12.2344 15 10C15 8.5 14 7 12 7C10.4521 7 9.50325 7.89844 9.15332 9M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z',
stroke: '#ffa726',
'stroke-width': '2',
'stroke-linecap': 'round',
'stroke-linejoin': 'round'
})
]);
const post2SVG = h('svg', {
width: '800px',
height: '800px',
viewBox: '0 0 210.439 210.439',
fill: 'none',
xmlns: 'http://www.w3.org/2000/svg',
'xmlns:xlink': 'http://www.w3.org/1999/xlink',
'xml:space': 'preserve'
}, [
h('g', {}, [
h('path', {
d: 'M197.762,169.999L177.324,5.262c-0.408-3.288-3.398-5.625-6.693-5.215L5.893,20.484c-3.005,0.373-5.261,2.927-5.261,5.955 v166c0,3.314,2.686,6,6,6h166c3.313,0,6-2.686,6-6v-14.021l13.915-1.727c1.579-0.196,3.016-1.011,3.994-2.266 C197.518,173.17,197.958,171.578,197.762,169.999z M20.436,186.439h-7.805V123.53L20.436,186.439z M13.882,40.181 c-0.186,0.023-0.367,0.057-0.546,0.096l-1.183-9.536l154.915-19.22l1.18,9.509L13.882,40.181z M166.632,186.439h-52.65l52.65-6.532 V186.439z M31.372,185.656L14.805,52.124c0.184-0.006,0.368-0.011,0.554-0.034l154.365-19.151l16.563,133.497L31.372,185.656z',
fill: '#FFFFFF', // Changement de la couleur en blanc
})
])
]);
CMS.registerIcon('homePage', () => homeSVG);
CMS.registerIcon('menuPage', () => menuSVG);
CMS.registerIcon('settingsPage', () => settingsSVG);
CMS.registerIcon('postPage', () => post2SVG);
CMS.registerIcon('helpPage', () => helpSVG);
const TutorialPage = () => {
return h('div', {}, 'TODO tutoriel!');
};
CMS.registerAdditionalLink({
id: 'tutorial',
title: 'Tutoriel',
data: TutorialPage,
options: {
icon: 'helpPage',
},
});
CMS.init();