Skip to content

Commit 36e61c5

Browse files
committed
Use a modal window to confirm the blog post deletion
1 parent 0a2e717 commit 36e61c5

File tree

4 files changed

+29
-34
lines changed

4 files changed

+29
-34
lines changed

app/Resources/translations/messages.en.xliff

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,21 @@
8080
<source>action.delete_post</source>
8181
<target>Delete post</target>
8282
</trans-unit>
83-
<trans-unit id="action.delete_post_confirmation">
84-
<source>action.delete_post_confirmation</source>
83+
<trans-unit id="delete_post_modal.title">
84+
<source>delete_post_modal.title</source>
8585
<target>Are you sure you want to delete this post?</target>
8686
</trans-unit>
87-
<trans-unit id="title.confirmation_modal">
88-
<source>title.confirmation_modal</source>
89-
<target>Confirmation</target>
87+
<trans-unit id="delete_post_modal.body">
88+
<source>delete_post_modal.body</source>
89+
<target>This action cannot be undone.</target>
9090
</trans-unit>
91-
<trans-unit id="label.yes">
92-
<source>label.yes</source>
93-
<target>Yes</target>
91+
<trans-unit id="label.delete_post">
92+
<source>label.delete_post</source>
93+
<target>Delete post</target>
9494
</trans-unit>
95-
<trans-unit id="label.no">
96-
<source>label.no</source>
97-
<target>No</target>
95+
<trans-unit id="label.cancel">
96+
<source>label.cancel</source>
97+
<target>Cancel</target>
9898
</trans-unit>
9999
<trans-unit id="action.create_post">
100100
<source>action.create_post</source>

app/Resources/translations/messages.es.xliff

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,21 +84,21 @@
8484
<source>action.delete_post</source>
8585
<target>Borrar artículo</target>
8686
</trans-unit>
87-
<trans-unit id="action.delete_post_confirmation">
88-
<source>action.delete_post_confirmation</source>
87+
<trans-unit id="delete_post_modal.title">
88+
<source>delete_post_modal.title</source>
8989
<target>¿Está seguro que quiere eliminar este artículo?</target>
9090
</trans-unit>
91-
<trans-unit id="title.confirmation_modal">
92-
<source>title.confirmation_modal</source>
93-
<target>Confirmación</target>
91+
<trans-unit id="delete_post_modal.body">
92+
<source>delete_post_modal.body</source>
93+
<target>Esta acción no se puede deshacer.</target>
9494
</trans-unit>
95-
<trans-unit id="label.yes">
96-
<source>label.yes</source>
97-
<target></target>
95+
<trans-unit id="label.delete_post">
96+
<source>label.delete_post</source>
97+
<target>Borrar artículo</target>
9898
</trans-unit>
99-
<trans-unit id="label.no">
100-
<source>label.no</source>
101-
<target>No</target>
99+
<trans-unit id="label.cancel">
100+
<source>label.cancel</source>
101+
<target>Cancelar</target>
102102
</trans-unit>
103103
<trans-unit id="action.create_post">
104104
<source>action.create_post</source>

app/Resources/views/admin/blog/_form.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
{% if show_confirmation|default(false) %}
1010
{% set attr = {'data-confirmation': 'true'} %}
11-
{{ include('default/_confirmation_modal.html.twig', {'message': 'action.delete_post_confirmation'|trans}) }}
11+
{{ include('blog/_delete_post_confirmation.html.twig') }}
1212
{% endif %}
1313

1414
{{ form_start(form, { attr: attr|default({}) }) }}

app/Resources/views/default/_confirmation_modal.html.twig renamed to app/Resources/views/blog/_delete_post_confirmation.html.twig

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,16 @@
22
<div class="modal fade" id="confirmationModal" tabindex="-1">
33
<div class="modal-dialog">
44
<div class="modal-content">
5-
<div class="modal-header">
6-
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
7-
<span aria-hidden="true">&times;</span>
8-
</button>
9-
<h4 class="modal-title">{{ 'title.confirmation_modal'|trans }}</h4>
10-
</div>
115
<div class="modal-body">
12-
{{ message }}
6+
<h4>{{ 'delete_post_modal.title'|trans }}</h4>
7+
<p>{{ 'delete_post_modal.body'|trans }}</p>
138
</div>
149
<div class="modal-footer">
15-
<button type="button" class="btn btn-danger" id="btnYes" data-dismiss="modal">
16-
{{ 'label.yes'|trans }}
17-
</button>
1810
<button type="button" class="btn btn-default" id="btnNo" data-dismiss="modal">
19-
{{ 'label.no'|trans }}
11+
{{ 'label.cancel'|trans }}
12+
</button>
13+
<button type="button" class="btn btn-danger" id="btnYes" data-dismiss="modal">
14+
{{ 'label.delete_post'|trans }}
2015
</button>
2116
</div>
2217
</div>

0 commit comments

Comments
 (0)