From 8e31e176b901b2c9a6ccc8452bdf06de33472c83 Mon Sep 17 00:00:00 2001 From: Lukasz Ostafin Date: Fri, 1 Sep 2023 13:57:44 +0200 Subject: [PATCH] IBX-6315: Edit/Preview embedded items --- .../js/scripts/embedded.item.actions.js | 4 +- .../fieldType/edit/_ezobjectrelationlist.scss | 7 ++++ .../field_type/edit/relation_base.html.twig | 10 ++--- .../views/themes/admin/ui/html_body.html.twig | 42 ++++++++----------- 4 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/bundle/Resources/public/js/scripts/embedded.item.actions.js b/src/bundle/Resources/public/js/scripts/embedded.item.actions.js index 2cf73df17d..ffb0f3fa7b 100644 --- a/src/bundle/Resources/public/js/scripts/embedded.item.actions.js +++ b/src/bundle/Resources/public/js/scripts/embedded.item.actions.js @@ -156,10 +156,10 @@ ? { href: Routing.generate('ibexa.product_catalog.product.edit', { productCode, - languageCode: languages.languageCode, + languageCode: languages[0].languageCode, }), } - : { onClick: () => editContent({ contentId, locationId, languageCode: languages.languageCode }) }; + : { onClick: () => editContent({ contentId, locationId, languageCode: languages[0].languageCode }) }; return { label: Translator.trans(/*@Desc("Edit")*/ 'embedded_items.action.edit', {}, 'content'), diff --git a/src/bundle/Resources/public/scss/fieldType/edit/_ezobjectrelationlist.scss b/src/bundle/Resources/public/scss/fieldType/edit/_ezobjectrelationlist.scss index a4e077fa75..95cf838d92 100644 --- a/src/bundle/Resources/public/scss/fieldType/edit/_ezobjectrelationlist.scss +++ b/src/bundle/Resources/public/scss/fieldType/edit/_ezobjectrelationlist.scss @@ -61,6 +61,13 @@ &__table-action--remove-item { padding: calculateRem(4px); } + + &__actions-cell { + display: flex; + gap: calculateRem(4px); + justify-content: center; + align-items: center; + } } .btn { diff --git a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig index 0fc13c65e4..c953582b07 100644 --- a/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/field_type/edit/relation_base.html.twig @@ -76,9 +76,9 @@ {% set body_row_cols_template = body_row_cols_template|merge([ { - content: col_raw_actions, + content: col_raw_actions_template, raw: true, - has_icon: true, + class: 'ibexa-relations__actions-cell' }, ]) %} @@ -88,6 +88,7 @@ class: 'ibexa-relations__item', }) }} {% endset %} +
{% set attr = attr|merge({'hidden': 'hidden'}) %} {{ block('form_widget') }} - {% endblock %} diff --git a/src/bundle/Resources/views/themes/admin/ui/html_body.html.twig b/src/bundle/Resources/views/themes/admin/ui/html_body.html.twig index 3adb52a949..3e2b800863 100644 --- a/src/bundle/Resources/views/themes/admin/ui/html_body.html.twig +++ b/src/bundle/Resources/views/themes/admin/ui/html_body.html.twig @@ -2,31 +2,23 @@ {% set form = ibexa_render_embedded_item_edit_form() %} {{ form_start(form, { - attr: { target: '_blank' } + attr: { target: '_blank' } }) }} - {{ form_widget(form.content_info, { - attr: { - hidden: 'hidden', - class: 'ibexa-embedded-item-edit__form-field ibexa-embedded-item-edit__form-field--content-info' - } - }) }} - {{ form_widget(form.version_info, { - attr: { - hidden: 'hidden', - class: 'ibexa-embedded-item-edit__form-field ibexa-embedded-item-edit__form-field--version-info' - } - }) }} - {{ form_widget(form.language, { - attr: { - hidden: 'hidden', - class: 'ibexa-embedded-item-edit__form-field ibexa-embedded-item-edit__form-field--language' - } - }) }} - {{ form_widget(form.location, { - attr: { - hidden: 'hidden', - class: 'ibexa-embedded-item-edit__form-field ibexa-embedded-item-edit__form-field--location' - } - }) }} + {{ form_widget(form.content_info, { 'attr': { + 'hidden': 'hidden', + 'class': 'ibexa-embedded-item-edit__form-field ibexa-embedded-item-edit__form-field--content-info' + } }) }} + {{ form_widget(form.version_info, { 'attr': { + 'hidden': 'hidden', + 'class': 'ibexa-embedded-item-edit__form-field ibexa-embedded-item-edit__form-field--version-info' + } }) }} + {{ form_widget(form.language, { 'attr': { + 'hidden': 'hidden', + 'class': 'ibexa-embedded-item-edit__form-field ibexa-embedded-item-edit__form-field--language' + } }) }} + {{ form_widget(form.location, { 'attr': { + 'hidden': 'hidden', + 'class': 'ibexa-embedded-item-edit__form-field ibexa-embedded-item-edit__form-field--location' + } }) }} {{ form_end(form) }}