mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
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 } ) }} ```
This commit is contained in:
parent
7c1698ed98
commit
384cb6c793
22
Resources/views/Util/confirmation_template.html.twig
Normal file
22
Resources/views/Util/confirmation_template.html.twig
Normal file
@ -0,0 +1,22 @@
|
||||
{% if title is defined %}
|
||||
<h2>{{ title }}</h2>
|
||||
{% endif %}
|
||||
|
||||
{% if confirm_question is defined %}
|
||||
<p class="message-confirm">{{ confirm_question }}</p>
|
||||
{% endif %}
|
||||
|
||||
{{ form_start(form) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path(cancel_route, cancel_parameters|default( { } ) ) }}" class="sc-button bt-cancel">
|
||||
{{ 'Cancel'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
{{ form_widget(form.submit, { 'attr' : { 'class' : "sc-button bt-delete" } } ) }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{ form_end(form) }}
|
Loading…
x
Reference in New Issue
Block a user