{% macro regex_escape(value) -%} {{ value|replace('\\','\\\\')|replace('$','\\$')|replace('^','\\^')|replace('|','\\|')|replace('[','\\[')|replace(']','\\]')|replace('(','\\(')|replace(')','\\)')|replace('{','\\{')|replace('}','\\}')|replace('*','\\*')|replace('?','\\?')|replace('+','\\+')|replace('.','\\.') }} {%- endmacro -%} {% macro modal_dialog(id, title, submit='Submit', class="primary") -%} {%- endmacro %} {# USAGE: #} {# button_confirm(label=_('Delete'), target="#delete-sshkey-modal", action="delete", key=key.fingerprint) #} {# modal_confirm(id='delete-sshkey-modal', title=_('Delete SSH key'), message=_("Are you sure?"), fields=['action', 'key'], submit=_('Delete')) #} {# Button to confirm deletion. #} {% macro button_confirm(label, target, class="btn-danger", disabled=False) -%} {%- endmacro %} {# modal dialog for confirmation #} {% macro modal_confirm(id, title, message, fields, submit, confirm_value=None) -%} {% call modal_dialog(id, title, submit, class="danger") %} {% for f in fields %}{% endfor %}

{{ message }}

{% if confirm_value %}

{% trans %}This action can lead to data loss. To prevent accidental actions we ask you to confirm your intention.{% endtrans %}
{% trans %}Please type {{ confirm_value }} to proceed or close this modal to cancel.{% endtrans %}

{% endif %} {% endcall %} {%- endmacro %}