From 9c6283b6db0c9ef06a8a4eb4af8525ba2a05a568 Mon Sep 17 00:00:00 2001 From: Bartek Wajda Date: Thu, 8 Aug 2024 18:27:51 +0200 Subject: [PATCH 1/9] 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 2/9] 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 3/9] 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 4/9] 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 5/9] 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 6/9] 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 7/9] 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 8/9] 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 9/9] 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 {