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-5565: Add reusable delete confirmation modal #766

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
20 changes: 10 additions & 10 deletions src/bundle/Resources/translations/content_type.en.xliff
Original file line number Diff line number Diff line change
Expand Up @@ -816,16 +816,6 @@
<target state="new">Password must contain at least one non-alphanumeric character</target>
<note>key: field_definition.ezuser.require_at_least_one_non_alphanumeric_character</note>
</trans-unit>
<trans-unit id="283d87c7f3e760a02fde52274ed0a4a8523d2a0d" resname="field_definition.ezuser.require_not_compromised_password">
<source>Password must not be contained in a public breach.</source>
<target state="new">Password must not be contained in a public breach.</target>
<note>key: field_definition.ezuser.require_not_compromised_password</note>
</trans-unit>
<trans-unit id="99aa2f672dfd9206b58ddf5d78e6a695ceb9ebf1" resname="field_definition.ezuser.require_not_compromised_password_help">
<source>This uses the API at %link% to securely check breach data. The password is not transmitted to the API.</source>
<target state="new">This uses the API at %link% to securely check breach data. The password is not transmitted to the API.</target>
<note>key: field_definition.ezuser.require_not_compromised_password_help</note>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This translation is from a recent feature and I believe shouldn't be removed. But why extractor is removing it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in ddaa268 . By default jms translation extractor is not able to extract from help option.

</trans-unit>
<trans-unit id="26cb6ab7ae7e190a9d8d8b0411512b531c8c42ff" resname="field_definition.ezuser.require_at_least_one_numeric_character">
<source>Password must contain at least one number</source>
<target state="new">Password must contain at least one number</target>
Expand All @@ -841,6 +831,16 @@
<target state="new">Prevent reusing old password</target>
<note>key: field_definition.ezuser.require_new_password</note>
</trans-unit>
<trans-unit id="fdcfd21005fcd975636d979b1be61e28bb88d875" resname="field_definition.ezuser.require_not_compromised_password">
<source>Password must not be contained in a public breach.</source>
<target state="new">Password must not be contained in a public breach.</target>
<note>key: field_definition.ezuser.require_not_compromised_password</note>
</trans-unit>
<trans-unit id="73a71072b428bec8a32c4ca1cf4813314b2a783d" resname="field_definition.ezuser.require_not_compromised_password_help">
<source>This uses the API at %link% to securely check breach data. The password is not transmitted to the API.</source>
<target state="new">This uses the API at %link% to securely check breach data. The password is not transmitted to the API.</target>
<note>key: field_definition.ezuser.require_not_compromised_password_help</note>
</trans-unit>
<trans-unit id="100096c9b93ce532e7bf2f184d8e3f43374ae921" resname="field_definition.ezuser.require_unique_email">
<source>Email must be unique</source>
<target state="new">Email must be unique</target>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{% set confirm_button_rendered %}
tischsoic marked this conversation as resolved.
Show resolved Hide resolved
{%- block confirm_button -%}
<button
class="btn ibexa-btn ibexa-btn--primary ibexa-btn--trigger"
data-click="{{ data_click }}"
>
{{ 'modal.delete'|trans|desc('Delete') }}
</button>
{% endblock %}
{% endset %}

{% set cancel_button_rendered %}
{%- block cancel_button -%}
<button
type="button"
class="btn ibexa-btn ibexa-btn--secondary"
data-bs-dismiss="modal"
>
{{ 'modal.cancel'|trans|desc('Cancel') }}
</button>
{% endblock %}
{% endset %}

{% embed '@ibexadesign/ui/component/modal/modal.html.twig' with {
no_header: true,
id,
} %}
{% block body_content %}
{{ message }}
{% endblock %}
{% block footer_content %}
{{ confirm_button_rendered }}
{{ cancel_button_rendered }}
{% endblock %}
{% endembed %}
16 changes: 12 additions & 4 deletions src/lib/FieldType/Mapper/UserAccountFormMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Ibexa\AdminUi\FieldType\FieldDefinitionFormMapperInterface;
use Ibexa\AdminUi\Form\Data\FieldDefinitionData;
use Ibexa\ContentForms\Form\Type\FieldDefinition\User\PasswordConstraintCheckboxType;
use JMS\TranslationBundle\Model\Message;
use JMS\TranslationBundle\Translation\TranslationContainerInterface;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\IntegerType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
Expand All @@ -19,7 +21,7 @@
/**
* Maps a user FieldType.
*/
final class UserAccountFormMapper implements FieldDefinitionFormMapperInterface
final class UserAccountFormMapper implements FieldDefinitionFormMapperInterface, TranslationContainerInterface
{
/**
* {@inheritdoc}
Expand Down Expand Up @@ -52,9 +54,7 @@ public function mapFieldDefinitionForm(FormInterface $fieldDefinitionForm, Field
'property_path' => $validatorPropertyPathPrefix . '[requireNotCompromisedPassword]',
'label' => /** @Desc("Password must not be contained in a public breach.") */
'field_definition.ezuser.require_not_compromised_password',
'help' => /** @Desc("This uses the API at %link% to securely check breach data.
* The password is not transmitted to the API.") */
'field_definition.ezuser.require_not_compromised_password_help',
'help' => 'field_definition.ezuser.require_not_compromised_password_help',
'help_translation_parameters' => [
'%link%' => '<a href="https://haveibeenpwned.com/" target="_blank">https://haveibeenpwned.com/</a>',
],
Expand Down Expand Up @@ -119,6 +119,14 @@ public function configureOptions(OptionsResolver $resolver)
'translation_domain' => 'content_type',
]);
}

public static function getTranslationMessages(): array
{
return [
Message::create('field_definition.ezuser.require_not_compromised_password_help', 'content_type')
->setDesc('This uses the API at %link% to securely check breach data. The password is not transmitted to the API.'),
];
}
}

class_alias(UserAccountFormMapper::class, 'EzSystems\EzPlatformAdminUi\FieldType\Mapper\UserAccountFormMapper');