{% set title = _args.title %}
{% set transition = _args.transition|default('fade') %}
{% set close = (_args.close is defined) ? (_args.close is same as(true)) : true %}
{% set footer = (_args.footer is defined) ? (_args.footer is same as(true)) : true %}
{% set htmlId = _args.htmlId %}
{% set modalClass = _args.modalClass|default(null) %}
{% set media = (_args.media is defined) ? (_args.media is same as(true)) : false %}
{% set triggerHtmlId = _args.triggerHtmlId|default(null) %}
{% set triggerOptions = _args.triggerOptions|default({}) %}
<div class="modal {{ modalClass}} {{ transition }}" id="{{ htmlId }}">
<div class="modal-dialog {% if media %}modal-media{% endif %}">
<div class="modal-content">
<div class="modal-header">
{% if media %}
{% block header %}{% endblock %}
{% endif %}
{% if close %}
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
{% endif %}
<h4 class="modal-title">{{ title }}</h4>
</div>
<div class="modal-body">
{% block body %}{% endblock %}
</div>
{% if footer %}
<div class="modal-footer">
{% block footer %}{% endblock %}
</div>
{% endif %}
</div>
</div>
</div>
{% if triggerHtmlId is not empty %}
{% inline_script %}
<script>
$(function() {
$('body').on('click', '#{{ triggerHtmlId }}', function (e) {
$('#{{ htmlId }}').modal({{ triggerOptions|json_encode }});
e.preventDefault();
e.stopPropagation();
});
});
</script>
{% endinline %}
{% endif %}