Created
August 20, 2021 21:03
-
-
Save bchopson/607735f52fdd02c03f80849e88fd1a8b to your computer and use it in GitHub Desktop.
Jinja confirm dialog replacement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% | |
macro confirm( | |
name, | |
title, | |
cancel_text='Cancel', | |
cancel_class='btn btn-secondary', | |
confirm_text='OK', | |
confirm_class='btn btn-primary' | |
) | |
-%} | |
<div class="modal fade" id="{{ name }}" tabindex="-1"> | |
<div class="modal-dialog modal-dialog-centered"> | |
<div class="modal-content"> | |
<div class="modal-header"> | |
<h5 class="modal-title">{{ title }}</h5> | |
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> | |
<span aria-hidden="true">×</span> | |
</button> | |
</div> | |
<div class="modal-body"> | |
{{ caller() }} | |
</div> | |
<div class="modal-footer"> | |
<button type="button" id="{{ name }}-cancel" class="{{ cancel_class }}" data-dismiss="modal">{{ cancel_text }}</button> | |
<button type="button" id="{{ name }}-confirm" class="{{ confirm_class }}">{{ confirm_text }}</button> | |
</div> | |
</div> | |
</div> | |
</div> | |
{%- endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment