Bug fixes for confirmDelete and lesion management
This commit is contained in:
1 parent
5eb8a717cb
commit
4ae0183a9c
6 files changed
+43
-14
No files matched your search
+19
-4
@@ -9,9 +9,10 @@ function closeHandler() {
|
||||
delete Template.confirmDeleteDialog.doneCallback;
|
||||
}
|
||||
|
||||
showConfirmDialog = function(doneCallback) {
|
||||
showConfirmDialog = function(doneCallback, options) {
|
||||
// Show the backdrop
|
||||
UI.render(Template.removableBackdrop, document.body);
|
||||
options = options || {};
|
||||
UI.renderWithData(Template.removableBackdrop, options, document.body);
|
||||
|
||||
// Make sure the context menu is closed when the user clicks away
|
||||
$(".removableBackdrop").one('mousedown touchstart', function() {
|
||||
@@ -25,13 +26,17 @@ showConfirmDialog = function(doneCallback) {
|
||||
}
|
||||
};
|
||||
|
||||
var keys = {
|
||||
ESC: 27,
|
||||
ENTER: 13
|
||||
};
|
||||
|
||||
Template.confirmDeleteDialog.events({
|
||||
'click #cancel, click #close': function() {
|
||||
closeHandler();
|
||||
},
|
||||
'click #confirm': function() {
|
||||
var doneCallback = Template.confirmDeleteDialog.doneCallback;
|
||||
|
||||
if (doneCallback && typeof doneCallback === 'function') {
|
||||
doneCallback();
|
||||
}
|
||||
@@ -39,12 +44,22 @@ Template.confirmDeleteDialog.events({
|
||||
closeHandler();
|
||||
},
|
||||
'keypress #confirmDeleteDialog': function(e) {
|
||||
if (e.which === keys.ESC) {
|
||||
closeHandler();
|
||||
}
|
||||
|
||||
if (this.keyPressAllowed === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
var doneCallback = Template.confirmDeleteDialog.doneCallback;
|
||||
|
||||
// If Enter is pressed, close the dialog
|
||||
if (e.which === 13) {
|
||||
if (e.which === keys.ENTER) {
|
||||
if (doneCallback && typeof doneCallback === 'function') {
|
||||
doneCallback();
|
||||
}
|
||||
|
||||
closeHandler();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user