From a2c441a86648e768bf662e76906cbac0f049f2c2 Mon Sep 17 00:00:00 2001 From: Arthaud Date: Sun, 10 Dec 2023 21:57:04 +0100 Subject: [PATCH] feat: add notes to paragraph and editorial block --- admin/app/blocks/editorial.js | 20 +++++++++++++++----- admin/app/blocks/paragraph.js | 25 ++++++++++++++++++------- admin/app/fields/notes.js | 21 +++++++++++++++++++++ admin/app/i18n/en/fields.js | 8 ++++++++ admin/app/i18n/fr/fields.js | 8 ++++++++ 5 files changed, 70 insertions(+), 12 deletions(-) create mode 100644 admin/app/fields/notes.js diff --git a/admin/app/blocks/editorial.js b/admin/app/blocks/editorial.js index 4c0902d..e6596a3 100644 --- a/admin/app/blocks/editorial.js +++ b/admin/app/blocks/editorial.js @@ -1,10 +1,11 @@ +import { background } from '../fields/background.js'; +import { cta } from '../fields/cta.js'; import { direction } from '../fields/direction.js'; +import { image } from '../fields/image.js'; +import { notes } from '../fields/notes.js'; import { surtitle } from '../fields/surtitle.js'; -import { title } from '../fields/title.js'; import { text_markdown } from '../fields/text-markdown.js'; -import { cta } from '../fields/cta.js'; -import { image } from '../fields/image.js'; -import { background } from '../fields/background.js'; +import { title } from '../fields/title.js'; import { t } from '../i18n/translater.js'; export const block_editorial = { @@ -15,5 +16,14 @@ export const block_editorial = { i18n: true, collapsed: false, summary: '{{title}}', - fields: [direction, surtitle, title, text_markdown, cta, image, background] + fields: [ + direction, + surtitle, + title, + text_markdown, + notes, + cta, + image, + background + ] }; diff --git a/admin/app/blocks/paragraph.js b/admin/app/blocks/paragraph.js index 802f941..4167e68 100644 --- a/admin/app/blocks/paragraph.js +++ b/admin/app/blocks/paragraph.js @@ -1,11 +1,12 @@ -import { surtitle } from '../fields/surtitle.js'; -import { title } from '../fields/title.js'; -import { text_markdown } from '../fields/text-markdown.js'; -import { grid } from '../fields/grid.js'; -import { offset } from '../fields/offset.js'; import { align } from '../fields/align.js'; -import { cta } from '../fields/cta.js'; import { background } from '../fields/background.js'; +import { cta } from '../fields/cta.js'; +import { grid } from '../fields/grid.js'; +import { notes } from '../fields/notes.js'; +import { offset } from '../fields/offset.js'; +import { surtitle } from '../fields/surtitle.js'; +import { text_markdown } from '../fields/text-markdown.js'; +import { title } from '../fields/title.js'; import { t } from '../i18n/translater.js'; export const block_paragraph = { @@ -16,5 +17,15 @@ export const block_paragraph = { i18n: true, collapsed: false, summary: '{{title}}', - fields: [surtitle, title, text_markdown, grid, offset, align, cta, background] + fields: [ + surtitle, + title, + text_markdown, + notes, + grid, + offset, + align, + cta, + background + ] }; diff --git a/admin/app/fields/notes.js b/admin/app/fields/notes.js new file mode 100644 index 0000000..4aaf498 --- /dev/null +++ b/admin/app/fields/notes.js @@ -0,0 +1,21 @@ +import { t } from '../i18n/translater.js'; + +export const notes = { + name: 'notes', + label: t.fields.notes.label, + label_singular: t.fields.notes.label_singular, + hint: t.fields.notes.hint, + widget: 'list', + collapsed: true, + minimize_collapsed: true, + required: false, + i18n: true, + summary: '', + fields: [ + { + label: t.fields.notes.field.label, + name: 'text', + widget: 'text' + } + ] +}; diff --git a/admin/app/i18n/en/fields.js b/admin/app/i18n/en/fields.js index e59ff88..68fe32b 100644 --- a/admin/app/i18n/en/fields.js +++ b/admin/app/i18n/en/fields.js @@ -233,6 +233,14 @@ export const fields = { hint: 'Name of the icon, doc : https://fonts.google.com/icons?icon.set=Material+Icons' }, name: 'Name', + notes: { + label: 'Notes', + label_singular: 'Note', + hint: 'Add a note, then link a word to the note by writing "[\\*]" after it. Notes and "[\\*]" are linked by their order.', + field: { + label: 'Text' + } + }, offer: 'Offer', offset: { label: 'Offset', diff --git a/admin/app/i18n/fr/fields.js b/admin/app/i18n/fr/fields.js index a7a9aea..e239078 100644 --- a/admin/app/i18n/fr/fields.js +++ b/admin/app/i18n/fr/fields.js @@ -232,6 +232,14 @@ export const fields = { hint: 'Le nom de l’icon, doc : https://fonts.google.com/icons?icon.set=Material+Icons' }, name: 'Nom', + notes: { + label: 'Notes', + label_singular: 'Note', + hint: 'Ajoutez une note, puis liez-la à un mot en ajoutant "[\\*]" juste après. Les notes et "[\\*]" sont liés par leur ordre.', + field: { + label: 'Texte' + } + }, offer: 'Offre', offset: { label: 'Alignement',