diff --git a/src/bundle/Resources/public/js/scripts/sidebar/btn/location.create.js b/src/bundle/Resources/public/js/scripts/sidebar/btn/location.create.js index ef143e4d81..de10fd4f5e 100644 --- a/src/bundle/Resources/public/js/scripts/sidebar/btn/location.create.js +++ b/src/bundle/Resources/public/js/scripts/sidebar/btn/location.create.js @@ -7,8 +7,19 @@ createActions.forEach((container) => { const radioInputs = container.querySelectorAll('.form-check [type="radio"]'); - const form = container.querySelector('form'); + const submitBtn = container.querySelector('.ibexa-extra-actions__btn--confirm'); + const cancelBtn = container.querySelector('.ibexa-extra-actions__btn--cancel'); + const closeBtn = container.querySelector('.ibexa-extra-actions__header .ibexa-btn--close'); - radioInputs.forEach((radioInput) => radioInput.addEventListener('change', () => form.submit(), false)); + cancelBtn.addEventListener('click', () => { closeBtn.click() }, false); + radioInputs.forEach((radioInput) => radioInput.addEventListener('change', (event) => { + const selectedItems = container.querySelectorAll('.ibexa-instant-filter__group-item--selected'); + const itemToSelect = event.currentTarget.closest('.ibexa-instant-filter__group-item'); + + selectedItems.forEach((selectedItem) => selectedItem.classList.remove('ibexa-instant-filter__group-item--selected')); + itemToSelect.classList.add('ibexa-instant-filter__group-item--selected'); + + submitBtn.removeAttribute('disabled'); + }, false)); }); })(window, window.document); diff --git a/src/bundle/Resources/public/scss/_extra-actions.scss b/src/bundle/Resources/public/scss/_extra-actions.scss index 997759424a..55e31bf621 100644 --- a/src/bundle/Resources/public/scss/_extra-actions.scss +++ b/src/bundle/Resources/public/scss/_extra-actions.scss @@ -82,6 +82,13 @@ } } + &__confirm-wrapper { + margin-top: calculateRem(20px); + padding: 0 calculateRem(32px); + display: flex; + gap: calculateRem(16px); + } + &--edit-user, &--edit { .form-check { @@ -126,7 +133,7 @@ &--create { .ibexa-extra-actions { &__content { - max-height: calc(100% - #{calculateRem(89px)}); + height: calc(100% - #{calculateRem(157px)}); overflow: auto; } diff --git a/src/bundle/Resources/views/themes/admin/content/widget/content_create.html.twig b/src/bundle/Resources/views/themes/admin/content/widget/content_create.html.twig index 6ca6f43436..7191485337 100644 --- a/src/bundle/Resources/views/themes/admin/content/widget/content_create.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/widget/content_create.html.twig @@ -1,27 +1,30 @@ {% trans_default_domain 'locationview' %} {% set data_actions = data_actions|default('create') %} +{% set action = action is defined ? action : path('ibexa.content.create') %} -
-
-

{{ 'content.create.create_content'|trans|desc('Create content') }}

- -
- {% if content is defined %} - {{ 'content.create.editing_details'|trans({ '%content_name%': ibexa_content_name(content) })|desc('under %content_name%') }} - {% endif %} +{{ form_start(form, { + action, + attr: { autocomplete: 'off' } +}) }} +
+
+

{{ 'content.create.create_content'|trans|desc('Create content') }}

+ +
+ {% if content is defined %} + {{ 'content.create.editing_details'|trans({ '%content_name%': ibexa_content_name(content) })|desc('under %content_name%') }} + {% endif %} +
-
-
- {% set action = action is defined ? action : path('ibexa.content.create') %} - {{ form_start(form, { - 'action': action, - 'attr': { 'autocomplete': 'off' } - }) }} +
{% if form.language.vars.choices|length == 1 %} @@ -49,7 +52,17 @@
- {{ form_widget(form.create, {'attr': {'hidden': 'hidden'}}) }} - {{ form_end(form) }} +
+
+ {{ form_widget(form.create, { + attr: { + disabled: true, + class: 'ibexa-btn ibexa-btn--primary ibexa-extra-actions__btn ibexa-extra-actions__btn--confirm' + } + }) }} + +
-
+{{ form_end(form) }}