From 9c6283b6db0c9ef06a8a4eb4af8525ba2a05a568 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Thu, 8 Aug 2024 18:27:51 +0200 Subject: [PATCH 01/13] IBX-8418: Added drafts deletion warning to trash modal --- src/bundle/Resources/translations/messages.en.xliff | 5 +++++ .../themes/admin/content/modal/location_trash.html.twig | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/bundle/Resources/translations/messages.en.xliff b/src/bundle/Resources/translations/messages.en.xliff index 397701950d..8714173155 100644 --- a/src/bundle/Resources/translations/messages.en.xliff +++ b/src/bundle/Resources/translations/messages.en.xliff @@ -688,6 +688,11 @@ Are you sure you want to send this Content item to Trash? key: trash.modal.send_to_trash.message + + Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree. + Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree. + key: trash.modal.send_to_trash_draft_warning.message + If you wish to delete these assets too, first make sure they are not used by other content. To check, go to the asset preview and look at its content Relations in the Relations tab. If you wish to delete these assets too, first make sure they are not used by other content. To check, go to the asset preview and look at its content Relations in the Relations tab. diff --git a/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig b/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig index 2e3fb3c7bd..35ef9e12da 100644 --- a/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig @@ -15,6 +15,13 @@ {% endblock %} {% block body_content %} {{ 'trash.modal.send_to_trash.message'|trans|desc('Are you sure you want to send this Content item to Trash?') }} +
+

+ +

+
{% for option in form.trash_options %}
From d21881bd5273d57b35d4bd129e064a2f552628a5 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Fri, 9 Aug 2024 17:08:44 +0200 Subject: [PATCH 02/13] IBX-8418: Fixup --- .../themes/admin/content/modal/location_trash.html.twig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig b/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig index 35ef9e12da..ac6cc44335 100644 --- a/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig @@ -16,10 +16,8 @@ {% block body_content %} {{ 'trash.modal.send_to_trash.message'|trans|desc('Are you sure you want to send this Content item to Trash?') }}
-

- +

+ {{ 'trash.modal.send_to_trash_draft_warning.message'|trans|desc('Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree.') }}

From f0e028e1251c1d3c84c6ccae7463384501225119 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Wed, 2 Oct 2024 16:00:00 +0200 Subject: [PATCH 03/13] IBX-8418: Refactored solution --- .../Resources/config/services/forms.yaml | 4 ++ .../CanHaveDrafts.php | 43 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php diff --git a/src/bundle/Resources/config/services/forms.yaml b/src/bundle/Resources/config/services/forms.yaml index a6f0893fec..2ce4762180 100644 --- a/src/bundle/Resources/config/services/forms.yaml +++ b/src/bundle/Resources/config/services/forms.yaml @@ -379,6 +379,10 @@ services: tags: - { name: ibexa.admin_ui.form.trash_location_option, priority: 60 } + Ibexa\AdminUi\Form\TrashLocationOptionProvider\CanHaveDrafts: + tags: + - { name: ibexa.admin_ui.form.trash_location_option, priority: 20 } + Ibexa\AdminUi\Form\TrashLocationOptionProvider\OptionsFactory: arguments: [!tagged ibexa.admin_ui.form.trash_location_option] diff --git a/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php b/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php new file mode 100644 index 0000000000..4f87add263 --- /dev/null +++ b/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php @@ -0,0 +1,43 @@ +translator = $translator; + } + + public function supports(Location $location): bool + { + return true; + } + + public function addOptions(FormInterface $form, Location $location): void + { + $form + ->add('can_have_drafts', ChoiceType::class, [ + 'label' => + /** @Desc("Drafts") */ + $this->translator->trans('drafts.list', [], 'ibexa_drafts'), + 'help_multiline' => [ + /** @Desc("Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree.") */ + $this->translator->trans('trash.modal.send_to_trash_draft_warning.message', [], 'messages'), + ], + ]); + } +} From 18b588d38f44979442ff127e654903808561ff33 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Wed, 2 Oct 2024 16:00:39 +0200 Subject: [PATCH 04/13] IBX-8418: Rollback --- .../themes/admin/content/modal/location_trash.html.twig | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig b/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig index ac6cc44335..d790c8b5f3 100644 --- a/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig @@ -14,12 +14,6 @@ {{ form_start(form, {'action': path('ibexa.location.trash')}) }} {% endblock %} {% block body_content %} - {{ 'trash.modal.send_to_trash.message'|trans|desc('Are you sure you want to send this Content item to Trash?') }} -
-

- {{ 'trash.modal.send_to_trash_draft_warning.message'|trans|desc('Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree.') }} -

-
{% for option in form.trash_options %}
From 8bb343fd8dfbfabd2d9d167b39421f211eed554c Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Wed, 2 Oct 2024 16:00:57 +0200 Subject: [PATCH 05/13] IBX-8418: Rollback --- .../views/themes/admin/content/modal/location_trash.html.twig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig b/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig index d790c8b5f3..2e3fb3c7bd 100644 --- a/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig +++ b/src/bundle/Resources/views/themes/admin/content/modal/location_trash.html.twig @@ -14,6 +14,7 @@ {{ form_start(form, {'action': path('ibexa.location.trash')}) }} {% endblock %} {% block body_content %} + {{ 'trash.modal.send_to_trash.message'|trans|desc('Are you sure you want to send this Content item to Trash?') }} {% for option in form.trash_options %}
From f52dd78c63e49a16402f07e3f8b3a97c5420048e Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Thu, 3 Oct 2024 10:09:40 +0200 Subject: [PATCH 06/13] IBX-8414: Change translation domain --- src/bundle/Resources/translations/ibexa_drafts.en.xliff | 5 +++++ src/bundle/Resources/translations/messages.en.xliff | 5 ----- src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/bundle/Resources/translations/ibexa_drafts.en.xliff b/src/bundle/Resources/translations/ibexa_drafts.en.xliff index b71e873df7..1a0596f0a8 100644 --- a/src/bundle/Resources/translations/ibexa_drafts.en.xliff +++ b/src/bundle/Resources/translations/ibexa_drafts.en.xliff @@ -66,6 +66,11 @@ Version key: drafts.list.version + + Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree. + Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree. + key: trash.modal.send_to_trash_draft_warning.message + diff --git a/src/bundle/Resources/translations/messages.en.xliff b/src/bundle/Resources/translations/messages.en.xliff index 8714173155..397701950d 100644 --- a/src/bundle/Resources/translations/messages.en.xliff +++ b/src/bundle/Resources/translations/messages.en.xliff @@ -688,11 +688,6 @@ Are you sure you want to send this Content item to Trash? key: trash.modal.send_to_trash.message - - Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree. - Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree. - key: trash.modal.send_to_trash_draft_warning.message - If you wish to delete these assets too, first make sure they are not used by other content. To check, go to the asset preview and look at its content Relations in the Relations tab. If you wish to delete these assets too, first make sure they are not used by other content. To check, go to the asset preview and look at its content Relations in the Relations tab. diff --git a/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php b/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php index 4f87add263..c070fd69ec 100644 --- a/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php +++ b/src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php @@ -36,7 +36,7 @@ public function addOptions(FormInterface $form, Location $location): void $this->translator->trans('drafts.list', [], 'ibexa_drafts'), 'help_multiline' => [ /** @Desc("Sending this content item to Trash will also delete all drafts of content items that haven’t been published yet, and belong to the trashed subtree.") */ - $this->translator->trans('trash.modal.send_to_trash_draft_warning.message', [], 'messages'), + $this->translator->trans('trash.modal.send_to_trash_draft_warning.message', [], 'ibexa_drafts'), ], ]); } From d8d90a3be07fe52991d05a76ebcf67ae4a318597 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Thu, 24 Oct 2024 17:24:44 +0200 Subject: [PATCH 07/13] IBX-8418: Update styling for trash options --- src/bundle/Resources/public/scss/_modals.scss | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/bundle/Resources/public/scss/_modals.scss b/src/bundle/Resources/public/scss/_modals.scss index ff45e56ff6..16c31a16eb 100644 --- a/src/bundle/Resources/public/scss/_modals.scss +++ b/src/bundle/Resources/public/scss/_modals.scss @@ -21,6 +21,19 @@ .modal-body { @include modal-body(); + + .ibexa-modal__option-label { + margin-bottom: 0; + margin-top: 1rem; + } + + .ibexa-label { + font-size: 1rem; + } + + .ibexa-modal__option-description { + font-size: 0.85rem; + } } .modal-footer { From 3613e0030e063189d153e256c197edf2e90e778f Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Fri, 25 Oct 2024 11:06:25 +0200 Subject: [PATCH 08/13] IBX-8418: Applied review remark --- src/bundle/Resources/public/scss/_modals.scss | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/bundle/Resources/public/scss/_modals.scss b/src/bundle/Resources/public/scss/_modals.scss index 16c31a16eb..76d3f8c101 100644 --- a/src/bundle/Resources/public/scss/_modals.scss +++ b/src/bundle/Resources/public/scss/_modals.scss @@ -22,17 +22,19 @@ .modal-body { @include modal-body(); - .ibexa-modal__option-label { - margin-bottom: 0; - margin-top: 1rem; - } + .ibexa-modal__trash-option { + .ibexa-modal__option-label { + margin-bottom: 0; + margin-top: calculateRem(18px);; + } - .ibexa-label { - font-size: 1rem; - } + .ibexa-label { + font-size: calculateRem(16px); + } - .ibexa-modal__option-description { - font-size: 0.85rem; + .ibexa-modal__option-description { + font-size: calculateRem(14px); + } } } From 8b5db6841494cadf327b9ec5312fcc6bdb4f670e Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Fri, 25 Oct 2024 11:08:09 +0200 Subject: [PATCH 09/13] IBX-8418: CS --- src/bundle/Resources/public/scss/_modals.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bundle/Resources/public/scss/_modals.scss b/src/bundle/Resources/public/scss/_modals.scss index 76d3f8c101..b720929f1e 100644 --- a/src/bundle/Resources/public/scss/_modals.scss +++ b/src/bundle/Resources/public/scss/_modals.scss @@ -25,7 +25,7 @@ .ibexa-modal__trash-option { .ibexa-modal__option-label { margin-bottom: 0; - margin-top: calculateRem(18px);; + margin-top: calculateRem(18px); } .ibexa-label { From 0c81fd6f3498bfc0f96997c22a8e821751f31d0b Mon Sep 17 00:00:00 2001 From: katarzynazawada <> Date: Wed, 6 Nov 2024 10:14:21 +0100 Subject: [PATCH 10/13] IBX-8418: Added fix for behat tests --- .../config/services/test/components.yaml | 2 ++ .../Behat/Component/DeleteContentDialog.php | 26 +++++++++++++++++++ src/lib/Behat/Page/ContentViewPage.php | 8 +++++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/lib/Behat/Component/DeleteContentDialog.php diff --git a/src/bundle/Resources/config/services/test/components.yaml b/src/bundle/Resources/config/services/test/components.yaml index cdc42cce9a..101c17fbdf 100644 --- a/src/bundle/Resources/config/services/test/components.yaml +++ b/src/bundle/Resources/config/services/test/components.yaml @@ -57,3 +57,5 @@ services: Ibexa\AdminUi\Behat\Component\PropertiesList: ~ Ibexa\AdminUi\Behat\Component\FullView: ~ + + Ibexa\AdminUi\Behat\Component\DeleteContentDialog: ~ diff --git a/src/lib/Behat/Component/DeleteContentDialog.php b/src/lib/Behat/Component/DeleteContentDialog.php new file mode 100644 index 0000000000..ffe329c32d --- /dev/null +++ b/src/lib/Behat/Component/DeleteContentDialog.php @@ -0,0 +1,26 @@ +getHTMLPage()->find($this->getLocator('trashConfirmCheckbox'))->click(); + } + + public function specifyLocators(): array + { + return array_merge(parent::specifyLocators(), [ + new VisibleCSSLocator('trashConfirmCheckbox', '.modal-content .ibexa-input--checkbox'), + ]); + } +} \ No newline at end of file diff --git a/src/lib/Behat/Page/ContentViewPage.php b/src/lib/Behat/Page/ContentViewPage.php index 51b4a9d0c9..7ab43e378a 100644 --- a/src/lib/Behat/Page/ContentViewPage.php +++ b/src/lib/Behat/Page/ContentViewPage.php @@ -13,6 +13,7 @@ use Ibexa\AdminUi\Behat\Component\ContentActionsMenu; use Ibexa\AdminUi\Behat\Component\ContentItemAdminPreview; use Ibexa\AdminUi\Behat\Component\ContentTypePicker; +use Ibexa\AdminUi\Behat\Component\DeleteContentDialog; use Ibexa\AdminUi\Behat\Component\Dialog; use Ibexa\AdminUi\Behat\Component\IbexaDropdown; use Ibexa\AdminUi\Behat\Component\LanguagePicker; @@ -82,6 +83,8 @@ class ContentViewPage extends Page private UpperMenu $upperMenu; + private DeleteContentDialog $deleteContentDialog; + public function __construct( Session $session, Router $router, @@ -97,7 +100,8 @@ public function __construct( ArgumentParser $argumentParser, UniversalDiscoveryWidget $universalDiscoveryWidget, IbexaDropdown $ibexaDropdown, - UpperMenu $upperMenu + UpperMenu $upperMenu, + DeleteContentDialog $deleteContentDialog ) { parent::__construct($session, $router); $this->contentActionsMenu = $contentActionsMenu; @@ -113,6 +117,7 @@ public function __construct( $this->universalDiscoveryWidget = $universalDiscoveryWidget; $this->ibexaDropdown = $ibexaDropdown; $this->upperMenu = $upperMenu; + $this->deleteContentDialog = $deleteContentDialog; } public function startCreatingContent(string $contentTypeName, string $language = null) @@ -267,6 +272,7 @@ public function sendToTrash() { $this->contentActionsMenu->clickButton('Send to trash'); $this->dialog->verifyIsLoaded(); + $this->deleteContentDialog->confirmTrashing(); $this->dialog->confirm(); } From 01bf828cdaeefb9dc6ff1b74d6598c652d32963b Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Wed, 6 Nov 2024 10:23:56 +0100 Subject: [PATCH 11/13] IBX-8418: PHPStan --- phpstan-baseline.neon | 4 ++-- src/lib/Behat/Component/DeleteContentDialog.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 6c0b4b0ad4..29ca53b8d0 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -456,7 +456,7 @@ parameters: path: src/bundle/Controller/LinkManagerController.php - - message: "#^Cannot access offset 0 on iterable\\\\.$#" + message: "#^Cannot access offset 0 on iterable\\\\.$#" count: 1 path: src/bundle/Controller/LocationController.php @@ -9546,7 +9546,7 @@ parameters: path: src/lib/UI/Dataset/VersionsDataset.php - - message: "#^Parameter \\#2 \\$array of function array_map expects array, iterable\\ given\\.$#" + message: "#^Parameter \\#2 \\$array of function array_map expects array, iterable\\ given\\.$#" count: 1 path: src/lib/UI/Dataset/VersionsDataset.php diff --git a/src/lib/Behat/Component/DeleteContentDialog.php b/src/lib/Behat/Component/DeleteContentDialog.php index ffe329c32d..574829ad1b 100644 --- a/src/lib/Behat/Component/DeleteContentDialog.php +++ b/src/lib/Behat/Component/DeleteContentDialog.php @@ -23,4 +23,4 @@ public function specifyLocators(): array new VisibleCSSLocator('trashConfirmCheckbox', '.modal-content .ibexa-input--checkbox'), ]); } -} \ No newline at end of file +} From 05e199c36d1c2b43d519544568cad1ff0eaba259 Mon Sep 17 00:00:00 2001 From: katarzynazawada <> Date: Wed, 6 Nov 2024 13:30:09 +0100 Subject: [PATCH 12/13] IBX-8418: Added tmp dependency --- dependencies.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 dependencies.json diff --git a/dependencies.json b/dependencies.json new file mode 100644 index 0000000000..dc811707e6 --- /dev/null +++ b/dependencies.json @@ -0,0 +1,11 @@ +{ + "recipesEndpoint": "", + "packages": [ + { + "requirement": "dev-ibx-8418 as 4.6.x-dev", + "repositoryUrl": "https://github.com/ibexa/product-catalog", + "package": "ibexa/product-catalog", + "shouldBeAddedAsVCS": true + } + ] +} From d4aca5f565c5b14facc812126b351e0c19cd2c37 Mon Sep 17 00:00:00 2001 From: katarzynazawada <> Date: Wed, 6 Nov 2024 14:17:18 +0100 Subject: [PATCH 13/13] IBX-8418: Removed tmp dependency --- dependencies.json | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 dependencies.json diff --git a/dependencies.json b/dependencies.json deleted file mode 100644 index dc811707e6..0000000000 --- a/dependencies.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "recipesEndpoint": "", - "packages": [ - { - "requirement": "dev-ibx-8418 as 4.6.x-dev", - "repositoryUrl": "https://github.com/ibexa/product-catalog", - "package": "ibexa/product-catalog", - "shouldBeAddedAsVCS": true - } - ] -}