diff --git a/source/development/user-interface/layout-template-usage.rst b/source/development/user-interface/layout-template-usage.rst index 4939e8f01..e67221e75 100644 --- a/source/development/user-interface/layout-template-usage.rst +++ b/source/development/user-interface/layout-template-usage.rst @@ -139,3 +139,39 @@ See : - :ref:`Macros in group bundle ` ; - :ref:`Macros in main bundle ` ; +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 + } ) }}