Files
karma/assets/templates/modal.html
Łukasz Mierzwa 7f3c414189 Don't leak event listeners in the silence form
Event listeners are setup on the modal div, but that div is not removed when the modal is hidden, only its children. This means that event listeners are stacked every time you show and hide a form. To reproduce this issue:
1. open silence form, click up button above hours, it will increment from 1 to 2
2. hide the form
3. re-open silence form, click up button above hours, it will increment from 1 to 3
4. repeat and every time increment will get a new listener that will cause higher value bump

This PR moves all listeners to the silence form element, which is removed when modal is closed, so all even listeners are destroyed properly and this bug no longer gets triggered.
Same fix is applied to the quick filter modal, it's present there but the effect there isn't as visible
2017-04-26 17:37:13 -07:00

34 lines
953 B
HTML

<script type="application/json" id="modal-title">
<button class="close" type="button" data-dismiss="modal">
<i class="fa fa-close"/>
</button>
<div class="label-list label <%= attrs.class %>" style="<%= attrs.style %>">
<%- attrs.text %>
</div>
<span class="badge badge-primary">
<%- counter %>
</span>
</script>
<script type="application/json" id="modal-body">
<table class="table table-striped modal-table">
<caption class="text-center">
Quick filters
</caption>
<tbody>
<% _.each(hints, function(hint) { %>
<tr>
<td class="modal-row-filters">
<%- hint %>
</td>
<td class="modal-row-actions">
<button class="btn btn-sm btn-primary pull-right modal-button-filter" type="button" data-filter-append-value="<%= hint %>">
Apply
</button>
</td>
</tr>
<% }) %>
</tbody>
</table>
</script>