From a398be26838dccbf0ce6a94ec4e882dd45d7e48d Mon Sep 17 00:00:00 2001 From: "Javi H. Gil" Date: Thu, 23 Nov 2023 14:05:05 +0100 Subject: [PATCH 1/5] Group modules edition form fields into accordions --- modules/button/form.html.twig | 46 ++++--- .../translations/sfs_cms_modules.en.yaml | 5 + .../translations/sfs_cms_modules.es.yaml | 5 + modules/card/form.html.twig | 105 ++++++++++------ .../card/translations/sfs_cms_modules.en.yaml | 7 ++ .../card/translations/sfs_cms_modules.es.yaml | 7 ++ modules/carousel/form.html.twig | 46 +++++++ .../translations/sfs_cms_modules.en.yaml | 4 + .../translations/sfs_cms_modules.es.yaml | 4 + modules/code/form.html.twig | 16 ++- .../code/translations/sfs_cms_modules.en.yaml | 4 + .../code/translations/sfs_cms_modules.es.yaml | 4 + modules/hero/form.html.twig | 117 ++++++++++++------ .../hero/translations/sfs_cms_modules.en.yaml | 9 ++ .../hero/translations/sfs_cms_modules.es.yaml | 9 ++ modules/media/form.html.twig | 21 ++-- .../translations/sfs_cms_modules.en.yaml | 5 + .../translations/sfs_cms_modules.es.yaml | 5 + modules/paragraph/form.html.twig | 28 ++++- .../translations/sfs_cms_modules.en.yaml | 5 + .../translations/sfs_cms_modules.es.yaml | 5 + modules/quote/form.html.twig | 28 ++++- .../translations/sfs_cms_modules.en.yaml | 5 + .../translations/sfs_cms_modules.es.yaml | 5 + modules/text_section/form.html.twig | 51 ++------ .../translations/sfs_cms_modules.en.yaml | 13 +- .../translations/sfs_cms_modules.es.yaml | 13 +- modules/title/form.html.twig | 16 ++- .../translations/sfs_cms_modules.en.yaml | 4 + .../translations/sfs_cms_modules.es.yaml | 4 + modules/two_columns/form.html.twig | 42 ++----- .../translations/sfs_cms_modules.en.yaml | 5 + .../translations/sfs_cms_modules.es.yaml | 5 + modules/wysiwyg/form.html.twig | 21 ++-- .../translations/sfs_cms_modules.en.yaml | 8 +- .../translations/sfs_cms_modules.es.yaml | 8 +- modules/wysiwyg_translatable/form.html.twig | 21 ++-- .../translations/sfs_cms_modules.en.yaml | 8 +- .../translations/sfs_cms_modules.es.yaml | 8 +- 39 files changed, 505 insertions(+), 217 deletions(-) create mode 100644 modules/carousel/form.html.twig diff --git a/modules/button/form.html.twig b/modules/button/form.html.twig index 15b8bdb..9226ee2 100644 --- a/modules/button/form.html.twig +++ b/modules/button/form.html.twig @@ -1,18 +1,28 @@ -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.button_style) }} -
-
- {{ form_row(form.button_classes) }} -
-
- {{ form_row(form.button_text) }} -
-
- {{ form_widget(form.button_link) }} -
-
-{{ form_rest(form) }} +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {% endblock %} +{% endembed %} + +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'button', 'accordion': accordion, 'open': true } %} + {% block form %} +
+
+ {{ form_row(form.button_style) }} +
+
+ {{ form_row(form.button_classes) }} +
+
+ {{ form_row(form.button_text) }} +
+
+ {{ form_widget(form.button_link) }} +
+
+ {% endblock %} +{% endembed %} \ No newline at end of file diff --git a/modules/button/translations/sfs_cms_modules.en.yaml b/modules/button/translations/sfs_cms_modules.en.yaml index b30ef51..e412300 100644 --- a/modules/button/translations/sfs_cms_modules.en.yaml +++ b/modules/button/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,11 @@ button: prototype_button: "Button" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" + button: "Button" locale_filter.label: "Locales" site_filter.label: "Sites" id.label: "Id" diff --git a/modules/button/translations/sfs_cms_modules.es.yaml b/modules/button/translations/sfs_cms_modules.es.yaml index c069440..0afc83d 100644 --- a/modules/button/translations/sfs_cms_modules.es.yaml +++ b/modules/button/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,11 @@ button: prototype_button: "Botón" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" + button: "Botón" locale_filter.label: "Idiomas" site_filter.label: "Sites" id.label: "Id" diff --git a/modules/card/form.html.twig b/modules/card/form.html.twig index 66aef8b..30f5e50 100644 --- a/modules/card/form.html.twig +++ b/modules/card/form.html.twig @@ -1,45 +1,68 @@ -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
+{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {{ form_row(form.content_position) }} +
+
+ {% endblock %} +{% endembed %} -
- {{ form_row(form.content_position) }} -
+{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'background', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.background) }} +
+
+ {{ form_row(form.bg_color) }} +
+
+ {% endblock %} +{% endembed %} -
- {{ form_row(form.title) }} -
-
- {{ form_row(form.title_type) }} -
-
- {{ form_row(form.title_class) }} -
-
- {{ form_row(form.media) }} -
+{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'title', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.title) }} +
+
+ {{ form_row(form.title_type) }} +
+
+ {{ form_row(form.title_class) }} +
+
+ {% endblock %} +{% endembed %} -
- {{ form_row(form.primary_button_text) }} -
-
- {{ form_widget(form.primary_button_link) }} -
-
- {{ form_row(form.primary_button_class) }} -
+{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'image', 'accordion': accordion } %} + {% block title %}Image{% endblock %} + {% block form %} +
+
+ {{ form_row(form.media) }} +
+
+ {% endblock %} +{% endembed %} - -
- {{ form_row(form.background) }} -
- -
- {{ form_row(form.bg_color) }} -
-
-{{ form_rest(form) }} +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'primary_button', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.primary_button_text) }} +
+
+ {{ form_widget(form.primary_button_link) }} +
+
+ {% endblock %} +{% endembed %} \ No newline at end of file diff --git a/modules/card/translations/sfs_cms_modules.en.yaml b/modules/card/translations/sfs_cms_modules.en.yaml index 8c8eeeb..28f8187 100644 --- a/modules/card/translations/sfs_cms_modules.en.yaml +++ b/modules/card/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,13 @@ card: prototype_button: "Card" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" + background: "Background" + title: "Title" + primary_button: "Primary button" locale_filter.label: "Locales" site_filter.label: "Sites" background.label: "Background image" diff --git a/modules/card/translations/sfs_cms_modules.es.yaml b/modules/card/translations/sfs_cms_modules.es.yaml index 1abf576..de0ca9d 100644 --- a/modules/card/translations/sfs_cms_modules.es.yaml +++ b/modules/card/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,13 @@ card: prototype_button: "Card" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" + background: "Fondo" + title: "Título" + primary_button: "Botón primario" locale_filter.label: "Idiomas" site_filter.label: "Sites" background.label: "Imagen de fondo" diff --git a/modules/carousel/form.html.twig b/modules/carousel/form.html.twig new file mode 100644 index 0000000..a39fd18 --- /dev/null +++ b/modules/carousel/form.html.twig @@ -0,0 +1,46 @@ +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {% endblock %} +{% endembed %} + +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'background', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.bg_color) }} +
+
+ {% endblock %} +{% endembed %} + + +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'properties', 'accordion': accordion, 'open': true } %} + {% block form %} +
+
+ {{ form_row(form.items_per_slide) }} +
+
+ {{ form_row(form.infinite_loop) }} +
+
+ {{ form_row(form.auto_play) }} +
+
+ {{ form_row(form.navigation) }} +
+
+ {{ form_row(form.pagination) }} +
+
+ {% endblock %} +{% endembed %} + diff --git a/modules/carousel/translations/sfs_cms_modules.en.yaml b/modules/carousel/translations/sfs_cms_modules.en.yaml index e299fcd..1331066 100644 --- a/modules/carousel/translations/sfs_cms_modules.en.yaml +++ b/modules/carousel/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,10 @@ carousel: prototype_button: "Carousel" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" locale_filter.label: "Locales" site_filter.label: "Sites" modules.label: "Modules" diff --git a/modules/carousel/translations/sfs_cms_modules.es.yaml b/modules/carousel/translations/sfs_cms_modules.es.yaml index 8bad924..34592ae 100644 --- a/modules/carousel/translations/sfs_cms_modules.es.yaml +++ b/modules/carousel/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,10 @@ carousel: prototype_button: "Carrusel" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" locale_filter.label: "Idiomas" site_filter.label: "Sites" modules.label: "Módulos" diff --git a/modules/code/form.html.twig b/modules/code/form.html.twig index 4d372e1..6b44003 100644 --- a/modules/code/form.html.twig +++ b/modules/code/form.html.twig @@ -1,6 +1,16 @@ +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {% endblock %} +{% endembed %} +
-
{{ form_row(form.id) }}
-
{{ form_row(form.class) }}
{{ form_row(form.code, {'attr': {'data-content-edit-preview': 'code'}}) }}
-
{{ form_rest(form) }}
diff --git a/modules/code/translations/sfs_cms_modules.en.yaml b/modules/code/translations/sfs_cms_modules.en.yaml index dba4388..c7cfd0a 100644 --- a/modules/code/translations/sfs_cms_modules.en.yaml +++ b/modules/code/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,10 @@ code: prototype_button: "Source code" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" locale_filter.label: "Locales" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/code/translations/sfs_cms_modules.es.yaml b/modules/code/translations/sfs_cms_modules.es.yaml index 32a4edb..be7bb89 100644 --- a/modules/code/translations/sfs_cms_modules.es.yaml +++ b/modules/code/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,10 @@ code: prototype_button: "Código fuente" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" locale_filter.label: "Idiomas" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/hero/form.html.twig b/modules/hero/form.html.twig index 7251f78..af2dfdb 100644 --- a/modules/hero/form.html.twig +++ b/modules/hero/form.html.twig @@ -1,36 +1,81 @@ -
-
- {{ form_row(form.background) }} -
-
- {{ form_row(form.media) }} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
-
- {{ form_row(form.title) }} -
-
- {{ form_row(form.title_type) }} -
-
- {{ form_row(form.title_class) }} -
-
- {{ form_row(form.primary_button_text) }} -
-
- {{ form_widget(form.primary_button_link) }} -
-
- {{ form_row(form.secondary_button_text) }} -
-
- {{ form_widget(form.secondary_button_link) }} -
-
-{{ form_rest(form) }} +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {{ form_row(form.fullpage) }} +
+
+ {% endblock %} +{% endembed %} + +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'background', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.background) }} +
+
+ {{ form_row(form.bg_color) }} +
+
+ {% endblock %} +{% endembed %} + +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'title', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.title) }} +
+
+ {{ form_row(form.title_type) }} +
+
+ {{ form_row(form.title_class) }} +
+
+ {% endblock %} +{% endembed %} + +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'image', 'accordion': accordion } %} + {% block title %}Image{% endblock %} + {% block form %} +
+
+ {{ form_row(form.media) }} +
+
+ {% endblock %} +{% endembed %} + +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'primary_button', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.primary_button_text) }} +
+
+ {{ form_widget(form.primary_button_link) }} +
+
+ {% endblock %} +{% endembed %} + +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'secondary_button', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.secondary_button_text) }} +
+
+ {{ form_widget(form.secondary_button_link) }} +
+
+ {% endblock %} +{% endembed %} diff --git a/modules/hero/translations/sfs_cms_modules.en.yaml b/modules/hero/translations/sfs_cms_modules.en.yaml index 2de2996..323fab2 100644 --- a/modules/hero/translations/sfs_cms_modules.en.yaml +++ b/modules/hero/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,15 @@ hero: prototype_button: "Hero" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" + background: "Background" + title: "Title" + image: "Main image" + primary_button: "Primary button" + secondary_button: "Secondary button" locale_filter.label: "Locales" site_filter.label: "Sites" background.label: "Background image" diff --git a/modules/hero/translations/sfs_cms_modules.es.yaml b/modules/hero/translations/sfs_cms_modules.es.yaml index fcf452a..8004fa4 100644 --- a/modules/hero/translations/sfs_cms_modules.es.yaml +++ b/modules/hero/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,15 @@ hero: prototype_button: "Hero" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" + background: "Fondo" + title: "Título" + image: "Imagen principal" + primary_button: "Botón principal" + secondary_button: "Botón secundario" locale_filter.label: "Idiomas" site_filter.label: "Sites" background.label: "Imagen de fondo" diff --git a/modules/media/form.html.twig b/modules/media/form.html.twig index 149d105..0ed177e 100644 --- a/modules/media/form.html.twig +++ b/modules/media/form.html.twig @@ -1,9 +1,12 @@ -
-
- {{ form_row(form.media) }} -
-
- {{ form_row(form.aligment_media) }} -
-
-{{ form_rest(form) }} +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'media', 'accordion': accordion, 'open': true } %} + {% block form %} +
+
+ {{ form_row(form.media) }} +
+
+ {{ form_row(form.aligment_media) }} +
+
+ {% endblock %} +{% endembed %} \ No newline at end of file diff --git a/modules/media/translations/sfs_cms_modules.en.yaml b/modules/media/translations/sfs_cms_modules.en.yaml index eb9e04c..6215e6c 100644 --- a/modules/media/translations/sfs_cms_modules.en.yaml +++ b/modules/media/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,11 @@ _group.media.name: "Multimedia" media: label: "Multimedia file" form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" + media: "Media file" locale_filter.label: "Locales" site_filter.label: "Sites" media.label: "File" diff --git a/modules/media/translations/sfs_cms_modules.es.yaml b/modules/media/translations/sfs_cms_modules.es.yaml index 46050db..81d72ec 100644 --- a/modules/media/translations/sfs_cms_modules.es.yaml +++ b/modules/media/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,11 @@ _group.media.name: "Multimedia" media: label: "Fichero multimedia" form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" + media: "Fichero multimedia" locale_filter.label: "Idiomas" site_filter.label: "Sites" media.label: "Fichero" diff --git a/modules/paragraph/form.html.twig b/modules/paragraph/form.html.twig index 0aaa44d..9c1bca9 100644 --- a/modules/paragraph/form.html.twig +++ b/modules/paragraph/form.html.twig @@ -1,6 +1,22 @@ -
-
{{ form_row(form.id) }}
-
{{ form_row(form.class) }}
-
{{ form_row(form.paragraph, {'attr': {'data-content-edit-preview': 'paragraph'}}) }}
-
{{ form_rest(form) }}
-
+{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {% endblock %} +{% endembed %} + +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'paragraph', 'accordion': accordion, 'open': true } %} + {% block form %} +
+
+ {{ form_row(form.paragraph, {'attr': {'data-content-edit-preview': 'paragraph'}}) }} +
+
+ {% endblock %} +{% endembed %} diff --git a/modules/paragraph/translations/sfs_cms_modules.en.yaml b/modules/paragraph/translations/sfs_cms_modules.en.yaml index 65f02c5..74a6ca9 100644 --- a/modules/paragraph/translations/sfs_cms_modules.en.yaml +++ b/modules/paragraph/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,11 @@ paragraph: prototype_button: "Paragraph" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" + paragraph: "Paragraph" locale_filter.label: "Locales" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/paragraph/translations/sfs_cms_modules.es.yaml b/modules/paragraph/translations/sfs_cms_modules.es.yaml index 0b6ffcb..f4bcf5f 100644 --- a/modules/paragraph/translations/sfs_cms_modules.es.yaml +++ b/modules/paragraph/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,11 @@ paragraph: prototype_button: "Párrafo" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" + paragraph: "Párrafo" locale_filter.label: "Idiomas" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/quote/form.html.twig b/modules/quote/form.html.twig index c8e7efd..5bce091 100644 --- a/modules/quote/form.html.twig +++ b/modules/quote/form.html.twig @@ -1,6 +1,22 @@ -
-
{{ form_row(form.id) }}
-
{{ form_row(form.class) }}
-
{{ form_row(form.quote, {'attr': {'data-content-edit-preview': 'quote'}}) }}
-
{{ form_rest(form) }}
-
+{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {% endblock %} +{% endembed %} + +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'quote', 'accordion': accordion, 'open': true } %} + {% block form %} +
+
+ {{ form_row(form.quote, {'attr': {'data-content-edit-preview': 'quote'}}) }} +
+
+ {% endblock %} +{% endembed %} diff --git a/modules/quote/translations/sfs_cms_modules.en.yaml b/modules/quote/translations/sfs_cms_modules.en.yaml index d766660..ac784b4 100644 --- a/modules/quote/translations/sfs_cms_modules.en.yaml +++ b/modules/quote/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,11 @@ quote: prototype_button: "quote" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" + quote: "Quote" locale_filter.label: "Locales" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/quote/translations/sfs_cms_modules.es.yaml b/modules/quote/translations/sfs_cms_modules.es.yaml index 81cb8ff..236fb53 100644 --- a/modules/quote/translations/sfs_cms_modules.es.yaml +++ b/modules/quote/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,11 @@ quote: prototype_button: "Cita" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" + quote: "Cita" locale_filter.label: "Idiomas" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/text_section/form.html.twig b/modules/text_section/form.html.twig index 3383eac..a188aee 100644 --- a/modules/text_section/form.html.twig +++ b/modules/text_section/form.html.twig @@ -1,39 +1,12 @@ -
-
- {{ form_row(form.background) }} -
-
- {{ form_row(form.bg_color) }} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
-
- {{ form_row(form.media) }} -
-
- {{ form_row(form.title) }} -
-
- {{ form_row(form.title_type) }} -
-
- {{ form_row(form.title_class) }} -
-
- {{ form_row(form.primary_button_text) }} -
-
- {{ form_widget(form.primary_button_link) }} -
-{#
#} -{# {{ form_row(form.jump_button_text) }}#} -{#
#} -{#
#} -{# {{ form_row(form.jump_button_link) }}#} -{#
#} -
-{{ form_rest(form) }} +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {% endblock %} +{% endembed %} diff --git a/modules/text_section/translations/sfs_cms_modules.en.yaml b/modules/text_section/translations/sfs_cms_modules.en.yaml index 3f89149..c3754b5 100644 --- a/modules/text_section/translations/sfs_cms_modules.en.yaml +++ b/modules/text_section/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,10 @@ text_section: prototype_button: "Text section" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" locale_filter.label: "Locales" site_filter.label: "Sites" background.label: "Background image" @@ -19,7 +23,9 @@ text_section: h4: "Heading 4" h5: "Heading 5" h6: "Heading 6" - description.label: "Description" + description: + label: "Description" + placeholder: "Insert description here" media.label: "Main image" text_position: label: "Text position" @@ -28,8 +34,11 @@ text_section: left: "Left" right: "Right" primary_button_class.label: "Primary button classes" - primary_button_text.label: "Primary button text" + primary_button_text: + label: "Primary button text" + placeholder: "Primary button" primary_button_link: + label: "Primary button link" type.label: "Primary button link type" route_name.label: "Route" route_params.label: "Route parameters" diff --git a/modules/text_section/translations/sfs_cms_modules.es.yaml b/modules/text_section/translations/sfs_cms_modules.es.yaml index ea83dc8..7e0de8d 100644 --- a/modules/text_section/translations/sfs_cms_modules.es.yaml +++ b/modules/text_section/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,10 @@ text_section: prototype_button: "Sección texto" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" locale_filter.label: "Idiomas" site_filter.label: "Sites" background.label: "Imagen de fondo" @@ -19,7 +23,9 @@ text_section: h4: "Encabezado 4" h5: "Encabezado 5" h6: "Encabezado 6" - description.label: "Descripción" + description: + label: "Descripción" + placeholder: "Inserta aquí la descripción" media.label: "Imagen principal" text_position: label: "Position del texto" @@ -28,8 +34,11 @@ text_section: left: "Izquierda" right: "Derecha" primary_button_class.label: "Classes del botón primario" - primary_button_text.label: "Texto del botón primario" + primary_button_text: + label: "Texto del botón primario" + placeholder: "Botón primario" primary_button_link: + label: "Enlace del botón primario" type.label: "Tipo de enlace del botón primario" route_name.label: "Ruta" route_params.label: "Parámetros de la ruta" diff --git a/modules/title/form.html.twig b/modules/title/form.html.twig index a19b567..c363af6 100644 --- a/modules/title/form.html.twig +++ b/modules/title/form.html.twig @@ -1,7 +1,17 @@ +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {% endblock %} +{% endembed %} +
-
{{ form_row(form.id) }}
-
{{ form_row(form.class) }}
{{ form_row(form.type) }}
{{ form_row(form.title, {'attr': {'data-content-edit-preview': 'title'}}) }}
-
{{ form_rest(form) }}
diff --git a/modules/title/translations/sfs_cms_modules.en.yaml b/modules/title/translations/sfs_cms_modules.en.yaml index 49b8fa6..f505595 100644 --- a/modules/title/translations/sfs_cms_modules.en.yaml +++ b/modules/title/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,10 @@ title: prototype_button: "Title" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" locale_filter.label: "Locales" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/title/translations/sfs_cms_modules.es.yaml b/modules/title/translations/sfs_cms_modules.es.yaml index ae51c78..6e51f95 100644 --- a/modules/title/translations/sfs_cms_modules.es.yaml +++ b/modules/title/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,10 @@ title: prototype_button: "Título" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" locale_filter.label: "Idiomas" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/two_columns/form.html.twig b/modules/two_columns/form.html.twig index 26d7b14..a188aee 100644 --- a/modules/two_columns/form.html.twig +++ b/modules/two_columns/form.html.twig @@ -1,30 +1,12 @@ -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
-
- {{ form_row(form.module_image) }} -
-
- {{ form_row(form.title) }} -
-
- {{ form_row(form.title_type) }} -
-
- {{ form_row(form.title_class) }} -
-{#
#} -{# {{ form_row(form.description) }}#} -{#
#} -
- {{ form_row(form.primary_button_text) }} -
-
- {{ form_widget(form.primary_button_link) }} -
-
-{{ form_rest(form) }} +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {% endblock %} +{% endembed %} diff --git a/modules/two_columns/translations/sfs_cms_modules.en.yaml b/modules/two_columns/translations/sfs_cms_modules.en.yaml index da02e0a..4a82300 100644 --- a/modules/two_columns/translations/sfs_cms_modules.en.yaml +++ b/modules/two_columns/translations/sfs_cms_modules.en.yaml @@ -3,6 +3,10 @@ two_columns: prototype_button: "Two columns" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" locale_filter.label: "Locales" site_filter.label: "Sites" background.label: "Background image" @@ -28,6 +32,7 @@ two_columns: label: "Primary button text" placeholder: "Primary button text" primary_button_link: + label: "Primary button link" type.label: "Primary button link type" route_name.label: "Route" route_params.label: "Route parameters" diff --git a/modules/two_columns/translations/sfs_cms_modules.es.yaml b/modules/two_columns/translations/sfs_cms_modules.es.yaml index edd4429..af40fae 100644 --- a/modules/two_columns/translations/sfs_cms_modules.es.yaml +++ b/modules/two_columns/translations/sfs_cms_modules.es.yaml @@ -3,6 +3,10 @@ two_columns: prototype_button: "Dos columnas" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" locale_filter.label: "Idiomas" site_filter.label: "Sites" background.label: "Imagen de fondo" @@ -28,6 +32,7 @@ two_columns: label: "Texto del botón primario" placeholder: "Texto del botón primario" primary_button_link: + label: "Enlace del botón primario" type.label: "Tipo de enlace del botón primario" route_name.label: "Ruta" route_params.label: "Parámetros de la ruta" diff --git a/modules/wysiwyg/form.html.twig b/modules/wysiwyg/form.html.twig index 384fd4a..3f82a2c 100644 --- a/modules/wysiwyg/form.html.twig +++ b/modules/wysiwyg/form.html.twig @@ -1,9 +1,12 @@ -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
-
-{{ form_rest(form) }} +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion, 'open': true } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {% endblock %} +{% endembed %} \ No newline at end of file diff --git a/modules/wysiwyg/translations/sfs_cms_modules.en.yaml b/modules/wysiwyg/translations/sfs_cms_modules.en.yaml index e954956..ad9a31d 100644 --- a/modules/wysiwyg/translations/sfs_cms_modules.en.yaml +++ b/modules/wysiwyg/translations/sfs_cms_modules.en.yaml @@ -3,8 +3,14 @@ wysiwyg: prototype_button: "WYSIWYG" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" locale_filter.label: "Locales" site_filter.label: "Sites" id.label: "Id" class.label: "Class" - content.label: "Content" + content: + label: "Content" + placeholder: "Insert content here" diff --git a/modules/wysiwyg/translations/sfs_cms_modules.es.yaml b/modules/wysiwyg/translations/sfs_cms_modules.es.yaml index bcce03d..11903d7 100644 --- a/modules/wysiwyg/translations/sfs_cms_modules.es.yaml +++ b/modules/wysiwyg/translations/sfs_cms_modules.es.yaml @@ -3,8 +3,14 @@ wysiwyg: prototype_button: "WYSIWYG" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" locale_filter.label: "Idiomas" site_filter.label: "Sites" id.label: "Id" class.label: "Clase" - content.label: "Contenido" + content: + label: "Contenido" + placeholder: "Inserta aquí el contenido" diff --git a/modules/wysiwyg_translatable/form.html.twig b/modules/wysiwyg_translatable/form.html.twig index 384fd4a..3f82a2c 100644 --- a/modules/wysiwyg_translatable/form.html.twig +++ b/modules/wysiwyg_translatable/form.html.twig @@ -1,9 +1,12 @@ -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
-
-{{ form_rest(form) }} +{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion, 'open': true } %} + {% block form %} +
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {% endblock %} +{% endembed %} \ No newline at end of file diff --git a/modules/wysiwyg_translatable/translations/sfs_cms_modules.en.yaml b/modules/wysiwyg_translatable/translations/sfs_cms_modules.en.yaml index b33dbc8..febf8cd 100644 --- a/modules/wysiwyg_translatable/translations/sfs_cms_modules.en.yaml +++ b/modules/wysiwyg_translatable/translations/sfs_cms_modules.en.yaml @@ -3,8 +3,14 @@ wysiwyg_translatable: prototype_button: "WYSIWYG translatable" prototype_button_icon: '' form: + _group: + filters: "Filters" + others: "Others" + attributes: "Attributes" locale_filter.label: "Locales" site_filter.label: "Sites" id.label: "Id" class.label: "Classes" - content.label: "Content" + content: + label: "Content" + placeholder: "Insert content here" diff --git a/modules/wysiwyg_translatable/translations/sfs_cms_modules.es.yaml b/modules/wysiwyg_translatable/translations/sfs_cms_modules.es.yaml index 0f3e958..e053a1e 100644 --- a/modules/wysiwyg_translatable/translations/sfs_cms_modules.es.yaml +++ b/modules/wysiwyg_translatable/translations/sfs_cms_modules.es.yaml @@ -3,8 +3,14 @@ wysiwyg_translatable: prototype_button: "WYSIWYG traducible" prototype_button_icon: '' form: + _group: + filters: "Filtros" + others: "Otros" + attributes: "Atributos" locale_filter.label: "Idiomas" site_filter.label: "Sites" id.label: "Id" class.label: "Clases" - content.label: "Contenido" + content: + label: "Contenido" + placeholder: "Inserta aquí el contenido" From 8caf668d1294aa069820c42f80962dca297aa97b Mon Sep 17 00:00:00 2001 From: "Javi H. Gil" Date: Thu, 23 Nov 2023 15:36:34 +0100 Subject: [PATCH 2/5] Update form templates --- modules/button/form.html.twig | 30 ++++---- modules/card/form.html.twig | 66 ++++++++--------- modules/carousel/form.html.twig | 49 ++++++------- modules/code/form.html.twig | 12 ++-- modules/hero/form.html.twig | 79 +++++++++------------ modules/media/form.html.twig | 12 ++-- modules/paragraph/form.html.twig | 18 ++--- modules/quote/form.html.twig | 18 ++--- modules/text_section/form.html.twig | 12 ++-- modules/title/form.html.twig | 26 ++++--- modules/two_columns/form.html.twig | 12 ++-- modules/wysiwyg/form.html.twig | 12 ++-- modules/wysiwyg_translatable/form.html.twig | 12 ++-- 13 files changed, 154 insertions(+), 204 deletions(-) diff --git a/modules/button/form.html.twig b/modules/button/form.html.twig index 9226ee2..1b256d0 100644 --- a/modules/button/form.html.twig +++ b/modules/button/form.html.twig @@ -1,28 +1,24 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.id) }} -
+
+ {{ form_row(form.id) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'button', 'accordion': accordion, 'open': true } %} {% block form %} -
-
- {{ form_row(form.button_style) }} -
-
- {{ form_row(form.button_classes) }} -
-
- {{ form_row(form.button_text) }} -
-
- {{ form_widget(form.button_link) }} -
+
+ {{ form_row(form.button_style) }} +
+
+ {{ form_row(form.button_classes) }} +
+
+ {{ form_row(form.button_text) }} +
+
+ {{ form_widget(form.button_link) }}
{% endblock %} {% endembed %} \ No newline at end of file diff --git a/modules/card/form.html.twig b/modules/card/form.html.twig index 30f5e50..b39c17a 100644 --- a/modules/card/form.html.twig +++ b/modules/card/form.html.twig @@ -1,44 +1,38 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
-
- {{ form_row(form.content_position) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {{ form_row(form.content_position) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'background', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.background) }} -
-
- {{ form_row(form.bg_color) }} -
+
+ {{ form_row(form.background) }} +
+
+ {{ form_row(form.bg_color) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'title', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.title) }} -
-
- {{ form_row(form.title_type) }} -
-
- {{ form_row(form.title_class) }} -
+
+ {{ form_row(form.title) }} +
+
+ {{ form_row(form.title_type) }} +
+
+ {{ form_row(form.title_class) }}
{% endblock %} {% endembed %} @@ -46,23 +40,19 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'image', 'accordion': accordion } %} {% block title %}Image{% endblock %} {% block form %} -
-
- {{ form_row(form.media) }} -
+
+ {{ form_row(form.media) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'primary_button', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.primary_button_text) }} -
-
- {{ form_widget(form.primary_button_link) }} -
+
+ {{ form_row(form.primary_button_text) }} +
+
+ {{ form_widget(form.primary_button_link) }}
{% endblock %} {% endembed %} \ No newline at end of file diff --git a/modules/carousel/form.html.twig b/modules/carousel/form.html.twig index a39fd18..27dafe5 100644 --- a/modules/carousel/form.html.twig +++ b/modules/carousel/form.html.twig @@ -1,45 +1,38 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'background', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.bg_color) }} -
+
+ {{ form_row(form.bg_color) }}
{% endblock %} {% endembed %} - {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'properties', 'accordion': accordion, 'open': true } %} {% block form %} -
-
- {{ form_row(form.items_per_slide) }} -
-
- {{ form_row(form.infinite_loop) }} -
-
- {{ form_row(form.auto_play) }} -
-
- {{ form_row(form.navigation) }} -
-
- {{ form_row(form.pagination) }} -
+
+ {{ form_row(form.items_per_slide) }} +
+
+ {{ form_row(form.infinite_loop) }} +
+
+ {{ form_row(form.auto_play) }} +
+
+ {{ form_row(form.navigation) }} +
+
+ {{ form_row(form.pagination) }}
{% endblock %} {% endembed %} diff --git a/modules/code/form.html.twig b/modules/code/form.html.twig index 6b44003..a0f4d2d 100644 --- a/modules/code/form.html.twig +++ b/modules/code/form.html.twig @@ -1,12 +1,10 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }}
{% endblock %} {% endembed %} diff --git a/modules/hero/form.html.twig b/modules/hero/form.html.twig index af2dfdb..e1cb064 100644 --- a/modules/hero/form.html.twig +++ b/modules/hero/form.html.twig @@ -1,81 +1,68 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
-
- {{ form_row(form.fullpage) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }} +
+
+ {{ form_row(form.fullpage) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'background', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.background) }} -
-
- {{ form_row(form.bg_color) }} -
+
+ {{ form_row(form.background) }} +
+
+ {{ form_row(form.bg_color) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'title', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.title) }} -
-
- {{ form_row(form.title_type) }} -
-
- {{ form_row(form.title_class) }} -
+
+ {{ form_row(form.title) }} +
+
+ {{ form_row(form.title_type) }} +
+
+ {{ form_row(form.title_class) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'image', 'accordion': accordion } %} - {% block title %}Image{% endblock %} {% block form %} -
-
- {{ form_row(form.media) }} -
+
+ {{ form_row(form.media) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'primary_button', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.primary_button_text) }} -
-
- {{ form_widget(form.primary_button_link) }} -
+
+ {{ form_row(form.primary_button_text) }} +
+
+ {{ form_widget(form.primary_button_link) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'secondary_button', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.secondary_button_text) }} -
-
- {{ form_widget(form.secondary_button_link) }} -
+
+ {{ form_row(form.secondary_button_text) }} +
+
+ {{ form_widget(form.secondary_button_link) }}
{% endblock %} {% endembed %} diff --git a/modules/media/form.html.twig b/modules/media/form.html.twig index 0ed177e..8f613e9 100644 --- a/modules/media/form.html.twig +++ b/modules/media/form.html.twig @@ -1,12 +1,10 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'media', 'accordion': accordion, 'open': true } %} {% block form %} -
-
- {{ form_row(form.media) }} -
-
- {{ form_row(form.aligment_media) }} -
+
+ {{ form_row(form.media) }} +
+
+ {{ form_row(form.aligment_media) }}
{% endblock %} {% endembed %} \ No newline at end of file diff --git a/modules/paragraph/form.html.twig b/modules/paragraph/form.html.twig index 9c1bca9..b2ae4b2 100644 --- a/modules/paragraph/form.html.twig +++ b/modules/paragraph/form.html.twig @@ -1,22 +1,18 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'paragraph', 'accordion': accordion, 'open': true } %} {% block form %} -
-
- {{ form_row(form.paragraph, {'attr': {'data-content-edit-preview': 'paragraph'}}) }} -
+
+ {{ form_row(form.paragraph, {'attr': {'data-content-edit-preview': 'paragraph'}}) }}
{% endblock %} {% endembed %} diff --git a/modules/quote/form.html.twig b/modules/quote/form.html.twig index 5bce091..86f3f00 100644 --- a/modules/quote/form.html.twig +++ b/modules/quote/form.html.twig @@ -1,22 +1,18 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'quote', 'accordion': accordion, 'open': true } %} {% block form %} -
-
- {{ form_row(form.quote, {'attr': {'data-content-edit-preview': 'quote'}}) }} -
+
+ {{ form_row(form.quote, {'attr': {'data-content-edit-preview': 'quote'}}) }}
{% endblock %} {% endembed %} diff --git a/modules/text_section/form.html.twig b/modules/text_section/form.html.twig index a188aee..c60e0c0 100644 --- a/modules/text_section/form.html.twig +++ b/modules/text_section/form.html.twig @@ -1,12 +1,10 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }}
{% endblock %} {% endembed %} diff --git a/modules/title/form.html.twig b/modules/title/form.html.twig index c363af6..eab1e41 100644 --- a/modules/title/form.html.twig +++ b/modules/title/form.html.twig @@ -1,17 +1,21 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }}
{% endblock %} {% endembed %} -
-
{{ form_row(form.type) }}
-
{{ form_row(form.title, {'attr': {'data-content-edit-preview': 'title'}}) }}
-
+{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'title', 'accordion': accordion, 'open': true } %} + {% block form %} +
+ {{ form_row(form.title, {'attr': {'data-content-edit-preview': 'title'}}) }} +
+
+ {{ form_row(form.type) }} +
+ {% endblock %} +{% endembed %} diff --git a/modules/two_columns/form.html.twig b/modules/two_columns/form.html.twig index a188aee..c60e0c0 100644 --- a/modules/two_columns/form.html.twig +++ b/modules/two_columns/form.html.twig @@ -1,12 +1,10 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }}
{% endblock %} {% endembed %} diff --git a/modules/wysiwyg/form.html.twig b/modules/wysiwyg/form.html.twig index 3f82a2c..6019f54 100644 --- a/modules/wysiwyg/form.html.twig +++ b/modules/wysiwyg/form.html.twig @@ -1,12 +1,10 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion, 'open': true } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }}
{% endblock %} {% endembed %} \ No newline at end of file diff --git a/modules/wysiwyg_translatable/form.html.twig b/modules/wysiwyg_translatable/form.html.twig index 3f82a2c..6019f54 100644 --- a/modules/wysiwyg_translatable/form.html.twig +++ b/modules/wysiwyg_translatable/form.html.twig @@ -1,12 +1,10 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion, 'open': true } %} {% block form %} -
-
- {{ form_row(form.id) }} -
-
- {{ form_row(form.class) }} -
+
+ {{ form_row(form.id) }} +
+
+ {{ form_row(form.class) }}
{% endblock %} {% endembed %} \ No newline at end of file From 6e8a31a2e5dfac288de225fb5c15cd18daf0e890 Mon Sep 17 00:00:00 2001 From: "Javi H. Gil" Date: Fri, 24 Nov 2023 13:16:52 +0100 Subject: [PATCH 3/5] Add missing translations --- modules/quote/translations/sfs_cms_modules.es.yaml | 2 +- modules/title/translations/sfs_cms_modules.en.yaml | 1 + modules/title/translations/sfs_cms_modules.es.yaml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/quote/translations/sfs_cms_modules.es.yaml b/modules/quote/translations/sfs_cms_modules.es.yaml index 236fb53..9c8abdf 100644 --- a/modules/quote/translations/sfs_cms_modules.es.yaml +++ b/modules/quote/translations/sfs_cms_modules.es.yaml @@ -15,4 +15,4 @@ quote: bg_color.label: "Color de fondo" quote: label: "Cita" - placeholder: "Inserta aquí el párrafo" + placeholder: "Inserta aquí la cita" diff --git a/modules/title/translations/sfs_cms_modules.en.yaml b/modules/title/translations/sfs_cms_modules.en.yaml index f505595..2fcc7a4 100644 --- a/modules/title/translations/sfs_cms_modules.en.yaml +++ b/modules/title/translations/sfs_cms_modules.en.yaml @@ -7,6 +7,7 @@ title: filters: "Filters" others: "Others" attributes: "Attributes" + title: "Title" locale_filter.label: "Locales" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/title/translations/sfs_cms_modules.es.yaml b/modules/title/translations/sfs_cms_modules.es.yaml index 6e51f95..95f6898 100644 --- a/modules/title/translations/sfs_cms_modules.es.yaml +++ b/modules/title/translations/sfs_cms_modules.es.yaml @@ -7,6 +7,7 @@ title: filters: "Filtros" others: "Otros" attributes: "Atributos" + title: "Título" locale_filter.label: "Idiomas" site_filter.label: "Sites" id.label: "HTML id" From 8fdedade5a8f118d0c51d669ff97b2bf31aeda2e Mon Sep 17 00:00:00 2001 From: "Javi H. Gil" Date: Sat, 25 Nov 2023 17:43:15 +0100 Subject: [PATCH 4/5] Review modules --- modules/button/config.yaml | 8 ++--- modules/button/form.html.twig | 13 +++---- .../translations/sfs_cms_modules.en.yaml | 9 +++-- .../translations/sfs_cms_modules.es.yaml | 11 +++--- modules/card/form.html.twig | 27 ++++++++------- .../card/translations/sfs_cms_modules.en.yaml | 8 ++--- .../card/translations/sfs_cms_modules.es.yaml | 8 ++--- modules/carousel/config.yaml | 1 + modules/carousel/form.html.twig | 8 ++--- .../translations/sfs_cms_modules.en.yaml | 2 ++ .../translations/sfs_cms_modules.es.yaml | 2 ++ modules/code/config.yaml | 10 +----- modules/code/edit.html.twig | 16 ++++----- modules/code/form.html.twig | 11 +++--- modules/code/render.html.twig | 2 +- .../code/translations/sfs_cms_modules.en.yaml | 1 + .../code/translations/sfs_cms_modules.es.yaml | 1 + modules/paragraph/config.yaml | 9 +---- modules/paragraph/edit.html.twig | 23 +++++-------- modules/paragraph/form.html.twig | 8 ++--- modules/paragraph/render.html.twig | 3 +- modules/quote/config.yaml | 9 +---- modules/quote/edit.html.twig | 34 ++++++++----------- modules/quote/form.html.twig | 8 ++--- modules/quote/render.html.twig | 3 +- modules/title/config.yaml | 1 + modules/title/edit.html.twig | 19 ++++------- modules/title/form.html.twig | 12 +++---- 28 files changed, 118 insertions(+), 149 deletions(-) diff --git a/modules/button/config.yaml b/modules/button/config.yaml index ba926ba..400bf7d 100644 --- a/modules/button/config.yaml +++ b/modules/button/config.yaml @@ -9,9 +9,13 @@ module: id: type: 'id' + button_classes: + type: 'class' + button_style: type: 'choice' type_options: + default_value: 'btn btn-primary' choices: "button.form.button_style.values.primary": 'btn btn-primary' "button.form.button_style.values.secondary": 'btn btn-secondary' @@ -23,10 +27,6 @@ module: "button.form.button_style.values.outline_success": 'btn btn-outline-success' "button.form.button_style.values.outline_danger": 'btn btn-outline-danger' "button.form.button_style.values.none": '' - choice_translation_domain: false - - button_classes: - type: 'class' button_text: type: 'translatable' diff --git a/modules/button/form.html.twig b/modules/button/form.html.twig index 1b256d0..6f1e1e8 100644 --- a/modules/button/form.html.twig +++ b/modules/button/form.html.twig @@ -1,19 +1,14 @@ -{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} - {% block form %} -
- {{ form_row(form.id) }} -
- {% endblock %} -{% endembed %} - {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'button', 'accordion': accordion, 'open': true } %} {% block form %}
- {{ form_row(form.button_style) }} + {{ form_widget(form.id) }}
{{ form_row(form.button_classes) }}
+
+ {{ form_row(form.button_style) }} +
{{ form_row(form.button_text) }}
diff --git a/modules/button/translations/sfs_cms_modules.en.yaml b/modules/button/translations/sfs_cms_modules.en.yaml index e412300..74f89d3 100644 --- a/modules/button/translations/sfs_cms_modules.en.yaml +++ b/modules/button/translations/sfs_cms_modules.en.yaml @@ -6,18 +6,17 @@ button: _group: filters: "Filters" others: "Others" - attributes: "Attributes" button: "Button" locale_filter.label: "Locales" site_filter.label: "Sites" id.label: "Id" class.label: "Classes" button_text: - label: "Button text" + label: "Text" placeholder: "Button" - button_classes.label: "Button classes" + button_classes.label: "Classes" button_link: - type.label: "Button link type" + type.label: "Link type" route_name.label: "Route" route_params.label: "Route parameters" anchor.label: "Anchor" @@ -25,7 +24,7 @@ button: custom_target.label: "Target id" url.label: "Direct URL" button_style: - label: "Button style" + label: "Style" values: primary: "Primary" secondary: "Secondary" diff --git a/modules/button/translations/sfs_cms_modules.es.yaml b/modules/button/translations/sfs_cms_modules.es.yaml index 0afc83d..d9f70ad 100644 --- a/modules/button/translations/sfs_cms_modules.es.yaml +++ b/modules/button/translations/sfs_cms_modules.es.yaml @@ -6,18 +6,17 @@ button: _group: filters: "Filtros" others: "Otros" - attributes: "Atributos" button: "Botón" locale_filter.label: "Idiomas" site_filter.label: "Sites" id.label: "Id" class.label: "Clases" button_text: - label: "Texto del botón" + label: "Texto" placeholder: "Botón" - button_classes.label: "Clases del botón" + button_classes.label: "Clases" button_link: - type.label: "Tipo de link del botón" + type.label: "Tipo de link" route_name.label: "Ruta" route_params.label: "Parámetros de la ruta" anchor.label: "Anchor" @@ -25,7 +24,7 @@ button: custom_target.label: "Identificador de target" url.label: "URL directa" button_style: - label: "Estilo del botón" + label: "Estilo" values: primary: "Primario" secondary: "Secundario" @@ -38,4 +37,4 @@ button: outline_danger: "Error hueco" none: "Ninguno" button_classes: - label: "Estilo del botón personalizado (clases CSS)" + label: "Estilo personalizado (clases CSS)" diff --git a/modules/card/form.html.twig b/modules/card/form.html.twig index b39c17a..a0ed2a8 100644 --- a/modules/card/form.html.twig +++ b/modules/card/form.html.twig @@ -1,10 +1,10 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
- {{ form_row(form.id) }} +
+ {{ form_widget(form.id) }}
-
- {{ form_row(form.class) }} +
+ {{ form_widget(form.class) }}
{{ form_row(form.content_position) }} @@ -25,14 +25,14 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'title', 'accordion': accordion } %} {% block form %} -
- {{ form_row(form.title) }} +
+ {{ form_widget(form.title_type) }}
-
- {{ form_row(form.title_type) }} +
+ {{ form_widget(form.title_class) }}
- {{ form_row(form.title_class) }} + {{ form_widget(form.title) }}
{% endblock %} {% endembed %} @@ -41,15 +41,18 @@ {% block title %}Image{% endblock %} {% block form %}
- {{ form_row(form.media) }} + {{ form_widget(form.media) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'primary_button', 'accordion': accordion } %} {% block form %} -
- {{ form_row(form.primary_button_text) }} +
+ {{ form_widget(form.primary_button_class) }} +
+
+ {{ form_widget(form.primary_button_text) }}
{{ form_widget(form.primary_button_link) }} diff --git a/modules/card/translations/sfs_cms_modules.en.yaml b/modules/card/translations/sfs_cms_modules.en.yaml index 28f8187..87c6af8 100644 --- a/modules/card/translations/sfs_cms_modules.en.yaml +++ b/modules/card/translations/sfs_cms_modules.en.yaml @@ -9,7 +9,7 @@ card: attributes: "Attributes" background: "Background" title: "Title" - primary_button: "Primary button" + primary_button: "Button" locale_filter.label: "Locales" site_filter.label: "Sites" background.label: "Background image" @@ -31,9 +31,9 @@ card: description: label: "Description" placeholder: "Card description" - primary_button_text.label: "Primary button text" + primary_button_text.label: "Text" primary_button_link: - type.label: "Primary button link type" + type.label: "Link type" route_name.label: "Route" route_params.label: "Route parameters" anchor.label: "Anchor" @@ -41,7 +41,7 @@ card: custom_target.label: "Target id" url.label: "Direct URL" bg_color.label: "Background color" - primary_button_class.label: "Primary button classes" + primary_button_class.label: "Classes" content_position.label: "Content position" content_position.values: left: "Left" diff --git a/modules/card/translations/sfs_cms_modules.es.yaml b/modules/card/translations/sfs_cms_modules.es.yaml index de0ca9d..cd8c00b 100644 --- a/modules/card/translations/sfs_cms_modules.es.yaml +++ b/modules/card/translations/sfs_cms_modules.es.yaml @@ -9,7 +9,7 @@ card: attributes: "Atributos" background: "Fondo" title: "Título" - primary_button: "Botón primario" + primary_button: "Botón" locale_filter.label: "Idiomas" site_filter.label: "Sites" background.label: "Imagen de fondo" @@ -31,9 +31,9 @@ card: description: label: "Descripción" placeholder: "Descripción de la tarjeta" - primary_button_text.label: "Texto del botón primario" + primary_button_text.label: "Texto" primary_button_link: - type.label: "Tipo de enlace del botón primario" + type.label: "Tipo de enlace" route_name.label: "Ruta" route_params.label: "Parámetros de la ruta" anchor.label: "Ancla" @@ -41,7 +41,7 @@ card: custom_target.label: "Identificador de target" url.label: "URL directa" bg_color.label: "Color de fondo" - primary_button_class.label: "Classes del botón primario" + primary_button_class.label: "Classes" content_position.label: "Posición del contenido" content_position.values: left: "Izquierda" diff --git a/modules/carousel/config.yaml b/modules/carousel/config.yaml index a6bd7b7..7c58754 100644 --- a/modules/carousel/config.yaml +++ b/modules/carousel/config.yaml @@ -2,6 +2,7 @@ module: revision: 1 group: 'container' edit_template: '@module/carousel/edit.html.twig' + form_template: '@module/carousel/form.html.twig' module_type: 'Softspring\CmsBundle\Form\Module\ContainerModuleType' module_options: module_collection_class: 'row' diff --git a/modules/carousel/form.html.twig b/modules/carousel/form.html.twig index 27dafe5..c044534 100644 --- a/modules/carousel/form.html.twig +++ b/modules/carousel/form.html.twig @@ -1,10 +1,10 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
- {{ form_row(form.id) }} +
+ {{ form_widget(form.id) }}
- {{ form_row(form.class) }} + {{ form_widget(form.class) }}
{% endblock %} {% endembed %} @@ -12,7 +12,7 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'background', 'accordion': accordion } %} {% block form %}
- {{ form_row(form.bg_color) }} + {{ form_widget(form.bg_color) }}
{% endblock %} {% endembed %} diff --git a/modules/carousel/translations/sfs_cms_modules.en.yaml b/modules/carousel/translations/sfs_cms_modules.en.yaml index 1331066..c46a450 100644 --- a/modules/carousel/translations/sfs_cms_modules.en.yaml +++ b/modules/carousel/translations/sfs_cms_modules.en.yaml @@ -7,6 +7,8 @@ carousel: filters: "Filters" others: "Others" attributes: "Attributes" + background: "Background" + properties: "Properties" locale_filter.label: "Locales" site_filter.label: "Sites" modules.label: "Modules" diff --git a/modules/carousel/translations/sfs_cms_modules.es.yaml b/modules/carousel/translations/sfs_cms_modules.es.yaml index 34592ae..2f03de5 100644 --- a/modules/carousel/translations/sfs_cms_modules.es.yaml +++ b/modules/carousel/translations/sfs_cms_modules.es.yaml @@ -7,6 +7,8 @@ carousel: filters: "Filtros" others: "Otros" attributes: "Atributos" + background: "Fondo" + properties: "Propiedades" locale_filter.label: "Idiomas" site_filter.label: "Sites" modules.label: "Módulos" diff --git a/modules/code/config.yaml b/modules/code/config.yaml index 79a0342..7fd3fcf 100644 --- a/modules/code/config.yaml +++ b/modules/code/config.yaml @@ -7,19 +7,11 @@ module: form_fields: id: type: 'id' - type_options: - attr: - data-edit-id-input: 'code' class: type: 'class' - type_options: - attr: - data-edit-class-input: 'code' code: - type: 'text' + type: 'textarea' type_options: constraints: [ 'notBlank' ] - attr: - data-edit-content-input: 'code' diff --git a/modules/code/edit.html.twig b/modules/code/edit.html.twig index 103065b..2461af5 100644 --- a/modules/code/edit.html.twig +++ b/modules/code/edit.html.twig @@ -1,12 +1,10 @@ {% trans_default_domain 'sfs_cms_modules' %} +{% import '@SfsCms/macros/modules_edit.html.twig' as module %} -
{{ form.code.vars.data|default|raw }}
+
{{ form.code.vars.data|default }}
diff --git a/modules/code/form.html.twig b/modules/code/form.html.twig index a0f4d2d..1708bbd 100644 --- a/modules/code/form.html.twig +++ b/modules/code/form.html.twig @@ -8,7 +8,10 @@
{% endblock %} {% endembed %} - -
-
{{ form_row(form.code, {'attr': {'data-content-edit-preview': 'code'}}) }}
-
+{% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'code', 'accordion': accordion, 'open': true } %} + {% block form %} +
+ {{ form_widget(form.code, {'attr': {'style': 'min-height: 300px'}}) }} +
+ {% endblock %} +{% endembed %} diff --git a/modules/code/render.html.twig b/modules/code/render.html.twig index 916dfd1..c2a945c 100644 --- a/modules/code/render.html.twig +++ b/modules/code/render.html.twig @@ -1 +1 @@ -
{{ code|raw }}
+
{{ code|raw }}
diff --git a/modules/code/translations/sfs_cms_modules.en.yaml b/modules/code/translations/sfs_cms_modules.en.yaml index c7cfd0a..29eecf5 100644 --- a/modules/code/translations/sfs_cms_modules.en.yaml +++ b/modules/code/translations/sfs_cms_modules.en.yaml @@ -7,6 +7,7 @@ code: filters: "Filters" others: "Others" attributes: "Attributes" + code: "Code" locale_filter.label: "Locales" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/code/translations/sfs_cms_modules.es.yaml b/modules/code/translations/sfs_cms_modules.es.yaml index be7bb89..e4146a1 100644 --- a/modules/code/translations/sfs_cms_modules.es.yaml +++ b/modules/code/translations/sfs_cms_modules.es.yaml @@ -7,6 +7,7 @@ code: filters: "Filtros" others: "Otros" attributes: "Atributos" + code: "Código" locale_filter.label: "Idiomas" site_filter.label: "Sites" id.label: "HTML id" diff --git a/modules/paragraph/config.yaml b/modules/paragraph/config.yaml index 04ab51d..f1ba590 100644 --- a/modules/paragraph/config.yaml +++ b/modules/paragraph/config.yaml @@ -7,20 +7,13 @@ module: form_fields: id: type: 'id' - type_options: - attr: - data-edit-id-input: 'paragraph' class: type: 'class' - type_options: - attr: - data-edit-class-input: 'paragraph' paragraph: type: 'translatable' type_options: + type: 'textarea' type_options: constraints: [ 'notBlank' ] - attr: - data-edit-content-input: 'paragraph' diff --git a/modules/paragraph/edit.html.twig b/modules/paragraph/edit.html.twig index 941c248..3b4be5d 100644 --- a/modules/paragraph/edit.html.twig +++ b/modules/paragraph/edit.html.twig @@ -1,19 +1,12 @@ -{% trans_default_domain 'sfs_cms_modules' %} +{% import '@SfsCms/macros/modules_edit.html.twig' as module %} {% for locale,localeField in form.paragraph %} -

{{ localeField.vars.data|default|raw }}

+

+ {{ localeField.vars.data|default|raw }} +

{% endfor %} diff --git a/modules/paragraph/form.html.twig b/modules/paragraph/form.html.twig index b2ae4b2..48c39d5 100644 --- a/modules/paragraph/form.html.twig +++ b/modules/paragraph/form.html.twig @@ -1,10 +1,10 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
- {{ form_row(form.id) }} +
+ {{ form_widget(form.id) }}
- {{ form_row(form.class) }} + {{ form_widget(form.class) }}
{% endblock %} {% endembed %} @@ -12,7 +12,7 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'paragraph', 'accordion': accordion, 'open': true } %} {% block form %}
- {{ form_row(form.paragraph, {'attr': {'data-content-edit-preview': 'paragraph'}}) }} + {{ form_widget(form.paragraph, {'children_attr': {'style': 'min-height: 300px'}}) }}
{% endblock %} {% endembed %} diff --git a/modules/paragraph/render.html.twig b/modules/paragraph/render.html.twig index 66d5921..b5ac439 100644 --- a/modules/paragraph/render.html.twig +++ b/modules/paragraph/render.html.twig @@ -1 +1,2 @@ -

{{ paragraph|sfs_cms_trans|raw }}

+{% import '@SfsCms/macros/modules_render.html.twig' as module %} +

{{ paragraph|sfs_cms_trans|raw }}

\ No newline at end of file diff --git a/modules/quote/config.yaml b/modules/quote/config.yaml index a3b069d..50ba60b 100644 --- a/modules/quote/config.yaml +++ b/modules/quote/config.yaml @@ -7,20 +7,13 @@ module: form_fields: id: type: 'id' - type_options: - attr: - data-edit-id-input: 'quote' class: type: 'class' - type_options: - attr: - data-edit-class-input: 'quote' quote: type: 'translatable' type_options: + type: 'textarea' type_options: constraints: [ 'notBlank' ] - attr: - data-edit-content-input: 'quote' diff --git a/modules/quote/edit.html.twig b/modules/quote/edit.html.twig index 842fde0..59e082d 100644 --- a/modules/quote/edit.html.twig +++ b/modules/quote/edit.html.twig @@ -1,19 +1,15 @@ -{% trans_default_domain 'sfs_cms_modules' %} - -{% for locale,localeField in form.quote %} -
{{ localeField.vars.data|default|raw }}
-{% endfor %} - +{% import '@SfsCms/macros/modules_edit.html.twig' as module %} + + +
+ {% for locale,localeField in form.quote %} +

+ {{ localeField.vars.data|default|raw }} +

+ {% endfor %} +
diff --git a/modules/quote/form.html.twig b/modules/quote/form.html.twig index 86f3f00..e1a785c 100644 --- a/modules/quote/form.html.twig +++ b/modules/quote/form.html.twig @@ -1,10 +1,10 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
- {{ form_row(form.id) }} +
+ {{ form_widget(form.id) }}
- {{ form_row(form.class) }} + {{ form_widget(form.class) }}
{% endblock %} {% endembed %} @@ -12,7 +12,7 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'quote', 'accordion': accordion, 'open': true } %} {% block form %}
- {{ form_row(form.quote, {'attr': {'data-content-edit-preview': 'quote'}}) }} + {{ form_widget(form.quote, {'children_attr': {'style': 'min-height: 300px'}}) }}
{% endblock %} {% endembed %} diff --git a/modules/quote/render.html.twig b/modules/quote/render.html.twig index e30964e..9d738b4 100644 --- a/modules/quote/render.html.twig +++ b/modules/quote/render.html.twig @@ -1 +1,2 @@ -
{{ quote|sfs_cms_trans|raw }}
+{% import '@SfsCms/macros/modules_render.html.twig' as module %} +

{{ quote|sfs_cms_trans|raw }}

\ No newline at end of file diff --git a/modules/title/config.yaml b/modules/title/config.yaml index 55e1ff6..c253a9d 100644 --- a/modules/title/config.yaml +++ b/modules/title/config.yaml @@ -14,6 +14,7 @@ module: type: type: 'choice' type_options: + default_value: h1 choices: "title.form.type.values.h1": h1 "title.form.type.values.h2": h2 diff --git a/modules/title/edit.html.twig b/modules/title/edit.html.twig index d9c73f5..73d9924 100644 --- a/modules/title/edit.html.twig +++ b/modules/title/edit.html.twig @@ -1,18 +1,13 @@ {% import '@SfsCms/macros/modules_edit.html.twig' as module %} -{% trans_default_domain 'sfs_cms_modules' %} -{% set type = form.type.vars.data|default('h1') %} - {% for locale,localeField in form.title %} - <{{ type}} - data-cms-module-title-type="" - {{ module.link_id(form.id) }} - {{ module.link_class(form.class, 'sfs-title') }} - {{ module.link_content(localeField, locale, true, 'title.form.title.placeholder') }} - - data-edit-content-enter-inserts-module="paragraph" - > + {{ module.start_link_tag_type(form.type,[ + module.link_id(form.id), + module.link_class(form.class, 'sfs-title'), + module.link_content(localeField, locale, true, 'title.form.title.placeholder'), + module.enter_inserts_module('paragraph') + ]) }} {{ localeField.vars.data|default|raw }} - + {{ module.end_link_tag_type(form.type) }} {% endfor %} diff --git a/modules/title/form.html.twig b/modules/title/form.html.twig index eab1e41..d64ef63 100644 --- a/modules/title/form.html.twig +++ b/modules/title/form.html.twig @@ -1,21 +1,21 @@ {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'attributes', 'accordion': accordion } %} {% block form %} -
- {{ form_row(form.id) }} +
+ {{ form_widget(form.id) }}
- {{ form_row(form.class) }} + {{ form_widget(form.class) }}
{% endblock %} {% endembed %} {% embed '@SfsCms/forms/modules_form_block.html.twig' with { 'name': 'title', 'accordion': accordion, 'open': true } %} {% block form %} -
- {{ form_row(form.title, {'attr': {'data-content-edit-preview': 'title'}}) }} +
+ {{ form_widget(form.type) }}
- {{ form_row(form.type) }} + {{ form_widget(form.title, {'attr': {'style': 'min-height: 300px'}}) }}
{% endblock %} {% endembed %} From 5d27e041a581e6adb5d90348b393918e2e5822ba Mon Sep 17 00:00:00 2001 From: "Javi H. Gil" Date: Tue, 28 Nov 2023 15:14:10 +0100 Subject: [PATCH 5/5] Add spacing type support --- modules/paragraph/config.yaml | 5 +- modules/paragraph/edit.html.twig | 2 +- modules/paragraph/form.html.twig | 3 + modules/paragraph/migrate.php | 11 +++ modules/paragraph/render.html.twig | 2 +- modules/title/config.yaml | 5 +- modules/title/edit.html.twig | 4 +- modules/title/form.html.twig | 3 + modules/title/migrate.php | 11 +++ modules/title/render.html.twig | 2 +- tests/modules/TitleTest.php | 105 +++++++++++++++++++++++++++++ 11 files changed, 146 insertions(+), 7 deletions(-) create mode 100644 modules/paragraph/migrate.php create mode 100644 modules/title/migrate.php create mode 100644 tests/modules/TitleTest.php diff --git a/modules/paragraph/config.yaml b/modules/paragraph/config.yaml index f1ba590..f65cc1e 100644 --- a/modules/paragraph/config.yaml +++ b/modules/paragraph/config.yaml @@ -1,5 +1,5 @@ module: - revision: 1 + revision: 2 group: 'basic' edit_template: '@module/paragraph/edit.html.twig' form_template: '@module/paragraph/form.html.twig' @@ -11,6 +11,9 @@ module: class: type: 'class' + spacing: + type: 'spacing' + paragraph: type: 'translatable' type_options: diff --git a/modules/paragraph/edit.html.twig b/modules/paragraph/edit.html.twig index 3b4be5d..5a967fa 100644 --- a/modules/paragraph/edit.html.twig +++ b/modules/paragraph/edit.html.twig @@ -2,7 +2,7 @@ {% for locale,localeField in form.paragraph %}

diff --git a/modules/paragraph/form.html.twig b/modules/paragraph/form.html.twig index 48c39d5..83d4460 100644 --- a/modules/paragraph/form.html.twig +++ b/modules/paragraph/form.html.twig @@ -6,6 +6,9 @@

{{ form_widget(form.class) }}
+
+ {{ form_widget(form.spacing) }} +
{% endblock %} {% endembed %} diff --git a/modules/paragraph/migrate.php b/modules/paragraph/migrate.php new file mode 100644 index 0000000..bf97894 --- /dev/null +++ b/modules/paragraph/migrate.php @@ -0,0 +1,11 @@ += 2) { + list($data['class'], $data['spacing']) = ModuleMigrator::classToSpacing($data['class']); + } + + return $data; +}; diff --git a/modules/paragraph/render.html.twig b/modules/paragraph/render.html.twig index b5ac439..79304b4 100644 --- a/modules/paragraph/render.html.twig +++ b/modules/paragraph/render.html.twig @@ -1,2 +1,2 @@ {% import '@SfsCms/macros/modules_render.html.twig' as module %} -

{{ paragraph|sfs_cms_trans|raw }}

\ No newline at end of file +

{{ paragraph|sfs_cms_trans|raw }}

\ No newline at end of file diff --git a/modules/title/config.yaml b/modules/title/config.yaml index c253a9d..c8aeee7 100644 --- a/modules/title/config.yaml +++ b/modules/title/config.yaml @@ -1,5 +1,5 @@ module: - revision: 1 + revision: 2 group: 'basic' edit_template: '@module/title/edit.html.twig' form_template: '@module/title/form.html.twig' @@ -11,6 +11,9 @@ module: class: type: 'class' + spacing: + type: 'spacing' + type: type: 'choice' type_options: diff --git a/modules/title/edit.html.twig b/modules/title/edit.html.twig index 73d9924..d917803 100644 --- a/modules/title/edit.html.twig +++ b/modules/title/edit.html.twig @@ -1,9 +1,9 @@ {% import '@SfsCms/macros/modules_edit.html.twig' as module %} {% for locale,localeField in form.title %} - {{ module.start_link_tag_type(form.type,[ + {{ module.start_link_tag_type(form.type, [ module.link_id(form.id), - module.link_class(form.class, 'sfs-title'), + module.link_class([form.class]|merge(form.spacing.children), 'sfs-title'), module.link_content(localeField, locale, true, 'title.form.title.placeholder'), module.enter_inserts_module('paragraph') ]) }} diff --git a/modules/title/form.html.twig b/modules/title/form.html.twig index d64ef63..5555ac0 100644 --- a/modules/title/form.html.twig +++ b/modules/title/form.html.twig @@ -6,6 +6,9 @@
{{ form_widget(form.class) }}
+
+ {{ form_widget(form.spacing) }} +
{% endblock %} {% endembed %} diff --git a/modules/title/migrate.php b/modules/title/migrate.php new file mode 100644 index 0000000..bf97894 --- /dev/null +++ b/modules/title/migrate.php @@ -0,0 +1,11 @@ += 2) { + list($data['class'], $data['spacing']) = ModuleMigrator::classToSpacing($data['class']); + } + + return $data; +}; diff --git a/modules/title/render.html.twig b/modules/title/render.html.twig index abbad55..4836632 100644 --- a/modules/title/render.html.twig +++ b/modules/title/render.html.twig @@ -1,3 +1,3 @@ {% import '@SfsCms/macros/modules_render.html.twig' as module %} -<{{ type }} {{ module.id(id) }} {{ module.class(class|default('mb-0'), 'sfs-title') }}>{{ title|sfs_cms_trans|raw }} +<{{ type }} {{ module.id(id) }} {{ module.class([class]|merge(spacing), 'sfs-title') }}>{{ title|sfs_cms_trans|raw }} diff --git a/tests/modules/TitleTest.php b/tests/modules/TitleTest.php new file mode 100644 index 0000000..b13ae3a --- /dev/null +++ b/tests/modules/TitleTest.php @@ -0,0 +1,105 @@ +moduleName = 'title'; + $this->modulePath = realpath(__DIR__ . '/../../modules/title'); + } + + protected function provideDataForMigrations(): array + { + return [ + [ + '_revision' => 1, + 'id' => 'mainTitle', + 'class' => 'example mx-2 my-3 text-dark pt-1 pb-2 ps-3 other-class', + 'type' => 'h1', + 'title' => ['en' => 'Test title'], + ], + [ + '_revision' => 2, + 'id' => 'mainTitle', + 'class' => 'example text-dark other-class', + 'type' => 'h1', + 'title' => ['en' => 'Test title'], + 'spacing' => [ + 'marginTop' => 'mt-3', + 'marginEnd' => 'me-2', + 'marginBottom' => 'mb-3', + 'marginStart' => 'ms-2', + 'paddingTop' => 'pt-1', + 'paddingEnd' => 'pe-0', + 'paddingBottom' => 'pb-2', + 'paddingStart' => 'ps-3', + ], + ], + ]; + } +// +// public function testEmptyForm(): void +// { +// $config = $this->readModuleConfiguration(); +// $form = $this->getModuleForm($config); +// $form->submit([]); +// $procesedData = $form->getData(); +// +// $this->assertTrue($form->isSynchronized()); +// // $this->assertFalse($form->isValid()); +// } +// +// public function testForm(): void +// { +// $config = $this->readModuleConfiguration(); +// $form = $this->getModuleForm($config); +// $form->submit([ +// 'locale_filter' => ['es'], +// 'id' => '', +// 'title_style' => 'btn btn-primary', +// 'title_classes' => '', +// 'title_text' => [ +// 'es' => 'Prueba', +// 'en' => 'Test', +// ], +// 'title_link' => [ +// 'type' => 'url', +// 'route_name' => '', +// 'route_params' => '', +// 'anchor' => '', +// 'url' => 'https://github.com/softspring/cms-bundle', +// 'target' => '_self', +// 'custom_target' => '', +// ], +// ]); +// $procesedData = $form->getData(); +// +// $this->assertTrue($form->isSynchronized()); +// +// $this->assertEquals([ +// '_node_discr' => null, +// '_revision' => null, +// 'id' => null, +// 'title_style' => 'btn btn-primary', +// 'title_classes' => null, +// 'title_text' => [ +// 'es' => 'Prueba', +// 'en' => 'Test', +// ], +// 'title_link' => [ +// 'type' => 'url', +// 'route_name' => '', +// 'route_params' => '', +// 'anchor' => '', +// 'url' => 'https://github.com/softspring/cms-bundle', +// 'target' => '_self', +// 'custom_target' => '', +// ], +// ], $procesedData); +// } +}