adding confirmation_template.html.twig

This commit is contained in:
Julien Fastré 2016-06-01 22:55:19 +02:00
parent 4d166498e5
commit 20845bd737

View File

@ -139,3 +139,39 @@ See :
- :ref:`Macros in group bundle <group-bundle-macros>` ;
- :ref:`Macros in main bundle <main-bundle-macros>` ;
Templates
---------
ChillMainBundle::Util:confirmation_template.html.twig
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This template show a confirmation template before making dangerous things. You can add your own message and title, or define those message by yourself in another template.
The accepted parameters are :
- `title` (string) a title for the page. Not mandatory (it won't be rendered if not defined)
- `confirm_question` (string) a confirmation question. This question will not be translated into the template, and may be printed as raw. Not mandatory (it won't be rendered if not defined)
- `form` : (:class:`Symfony\Component\Form\FormView`) a form wich **must** contains an input named `submit`, which must be a :class:`Symfony\Component\Form\Extension\Core\Type\SubmitType`. Mandatory
- `cancel_route` : (string) the name of a route if the user want to cancel the action
- `cancel_parameters` (array) the parameters for the route defined in `cancel_route`
Usage :
.. code-block:: html+jinja2
{{ 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 ?'|trans
# 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
} ) }}