get_my/client/General/modal/modal.js
Brian McGonagill 750811a81f initial commit
2022-08-04 19:50:18 -05:00

41 lines
1 KiB
JavaScript

Template.myModal.onCreated(function() {
});
Template.myModal.onRendered(function() {
$('.modal').modal();
});
Template.myModal.helpers({
modalHeader: function() {
return Session.get("confirmationDialogTitle");
},
modalBody: function() {
return Session.get("confirmationDialogContent");
}
});
Template.myModal.events({
'click #continue' (event) {
event.preventDefault();
let callFunction = Session.get("eventConfirmCallBackFunction");
let functionPassId = Session.get("eventConfirmNecessaryId"); // <-- this can be an actual ID, an object, a function, whatever...
if (functionPassId == "disallowCom") {
$("#genModal").modal('close');
return;
} else {
$("#genModal").modal('close');
window[callFunction](functionPassId); // <-- calls the function and passed the Id on confirm.
}
},
'click #cancel' (event) {
event.preventDefault();
$("#genModal").modal('close');
},
});