Only create the modal if it does not exist.
This commit is contained in:
parent
10ff284997
commit
cad2b468e4
|
@ -80,12 +80,18 @@
|
||||||
function openModal(e) {
|
function openModal(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
event_instance_id = e.target.dataset['eventinstanceId'];
|
event_instance_id = e.target.dataset['eventinstanceId'];
|
||||||
template = document.getElementById('event-template');
|
|
||||||
modal = template.cloneNode(true);
|
modal = modals[event_instance_id];
|
||||||
body = document.getElementsByTagName('body')[0];
|
|
||||||
body.appendChild(modal);
|
if(modal == undefined) {
|
||||||
modal.setAttribute('id', 'event-modal-' + event_instance_id)
|
template = document.getElementById('event-template');
|
||||||
modals[event_instance_id] = modal;
|
modal = template.cloneNode(true);
|
||||||
|
body = document.getElementsByTagName('body')[0];
|
||||||
|
body.appendChild(modal);
|
||||||
|
modal.setAttribute('id', 'event-modal-' + event_instance_id)
|
||||||
|
modals[event_instance_id] = modal;
|
||||||
|
}
|
||||||
|
|
||||||
$('#event-modal-' + event_instance_id).modal();
|
$('#event-modal-' + event_instance_id).modal();
|
||||||
webSocketBridge.send({action: 'get_event_instance', event_instance_id: event_instance_id})
|
webSocketBridge.send({action: 'get_event_instance', event_instance_id: event_instance_id})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue