Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8418: Added drafts deletion warning to trash modal #1321

Merged
merged 16 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/bundle/Resources/config/services/forms.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
15 changes: 15 additions & 0 deletions src/bundle/Resources/public/scss/_modals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@

.modal-body {
@include modal-body();

.ibexa-modal__trash-option {
.ibexa-modal__option-label {
margin-bottom: 0;
margin-top: calculateRem(18px);
}

.ibexa-label {
font-size: calculateRem(16px);
}

.ibexa-modal__option-description {
font-size: calculateRem(14px);
}
}
}

.modal-footer {
Expand Down
5 changes: 5 additions & 0 deletions src/bundle/Resources/translations/ibexa_drafts.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<target state="new">Version</target>
<note>key: drafts.list.version</note>
</trans-unit>
<trans-unit id="b107e8277d2dda6c41872a6478d99abbe9b46dc0" resname="trash.modal.send_to_trash_draft_warning.message">
<source>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.</source>
<target state="new">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.</target>
<note>key: trash.modal.send_to_trash_draft_warning.message</note>
</trans-unit>
</body>
</file>
</xliff>
43 changes: 43 additions & 0 deletions src/lib/Form/TrashLocationOptionProvider/CanHaveDrafts.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\AdminUi\Form\TrashLocationOptionProvider;

use Ibexa\Contracts\Core\Repository\Values\Content\Location;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormInterface;
use Symfony\Contracts\Translation\TranslatorInterface;

final class CanHaveDrafts implements TrashLocationOptionProvider
{
private TranslatorInterface $translator;

public function __construct(TranslatorInterface $translator)
{
$this->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', [], 'ibexa_drafts'),
],
]);
}
}
Loading