From 384cb6c793072a4f1047dc5cafc2157ee2419f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 1 Jun 2016 16:17:53 +0200 Subject: [PATCH] adding confirmation template For action which require a confirmation message. This is a way to have a template for every confirmation message in the app. Example of usage : ``` {{ include('ChillMainBundle:Util:confirmation_template.html.twig', { # a title, not mandatory 'title' : 'Remove membership'|trans, # a confirmation question, not mandatory 'confirm_question' : 'Are you sure you want to remove membership of "%name%" from the group "%group%"?'|trans({ '%name%' : person.firstname ~ ' ' ~ person.lastname, '%group%' : membership.cgroup.name }), # a route for "cancel" button (mandatory) 'cancel_route' : 'chill_group_membership_by_person', # the parameters for 'cancel' route (default to {} ) 'cancel_parameters' : { 'person_id' : membership.person.id }, # the form which will send the deletion. This form # **must** contains a SubmitType 'form' : form } ) }} ``` --- .../Util/confirmation_template.html.twig | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Resources/views/Util/confirmation_template.html.twig diff --git a/Resources/views/Util/confirmation_template.html.twig b/Resources/views/Util/confirmation_template.html.twig new file mode 100644 index 000000000..6bc06e67a --- /dev/null +++ b/Resources/views/Util/confirmation_template.html.twig @@ -0,0 +1,22 @@ +{% if title is defined %} +

{{ title }}

+{% endif %} + +{% if confirm_question is defined %} +

{{ confirm_question }}

+{% endif %} + +{{ form_start(form) }} + + + +{{ form_end(form) }} \ No newline at end of file