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'];
|
||||||
|
|
||||||
|
modal = modals[event_instance_id];
|
||||||
|
|
||||||
|
if(modal == undefined) {
|
||||||
template = document.getElementById('event-template');
|
template = document.getElementById('event-template');
|
||||||
modal = template.cloneNode(true);
|
modal = template.cloneNode(true);
|
||||||
body = document.getElementsByTagName('body')[0];
|
body = document.getElementsByTagName('body')[0];
|
||||||
body.appendChild(modal);
|
body.appendChild(modal);
|
||||||
modal.setAttribute('id', 'event-modal-' + event_instance_id)
|
modal.setAttribute('id', 'event-modal-' + event_instance_id)
|
||||||
modals[event_instance_id] = modal;
|
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