2015-10-23 18:21:46 +02:00
|
|
|
Template.lesionTableRow.helpers({
|
2016-01-11 11:32:20 +01:00
|
|
|
timepoints: function() {
|
|
|
|
|
return Timepoints.find({}, {
|
|
|
|
|
sort: {
|
|
|
|
|
timepointName: 1
|
|
|
|
|
}
|
|
|
|
|
});
|
2015-10-29 13:50:28 +01:00
|
|
|
}
|
2015-10-23 18:21:46 +02:00
|
|
|
});
|
2015-12-19 04:24:00 +01:00
|
|
|
|
|
|
|
|
function doneCallback(measurementData, deleteTool) {
|
|
|
|
|
// If a Lesion or Non-Target is removed via a dialog
|
|
|
|
|
// opened by the Lesion Table, we should clear the data for
|
|
|
|
|
// the specified Timepoint Cell
|
|
|
|
|
if (deleteTool === true) {
|
2016-01-11 11:32:20 +01:00
|
|
|
Meteor.call('removeMeasurement', measurementData.id, function(error, response) {
|
2016-01-09 23:04:22 +01:00
|
|
|
if (error) {
|
|
|
|
|
log.warn(error);
|
|
|
|
|
}
|
2015-12-19 04:24:00 +01:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-12-21 00:52:17 +01:00
|
|
|
// Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected
|
|
|
|
|
var keys = {
|
|
|
|
|
D: 68,
|
|
|
|
|
DELETE: 46
|
|
|
|
|
};
|
|
|
|
|
|
2015-12-19 04:24:00 +01:00
|
|
|
Template.lesionTableRow.events({
|
|
|
|
|
'dblclick .location': function() {
|
|
|
|
|
log.info('Double clicked on Lesion Location cell');
|
|
|
|
|
|
|
|
|
|
var measurementData = this;
|
|
|
|
|
|
|
|
|
|
// TODO = Fix this weird issue? Need to set toolData's ID properly..
|
|
|
|
|
measurementData.id = this._id;
|
|
|
|
|
|
|
|
|
|
changeLesionLocationCallback(measurementData, null, doneCallback);
|
|
|
|
|
},
|
2015-12-21 00:52:17 +01:00
|
|
|
'keydown .location': function(e) {
|
|
|
|
|
var keyCode = e.which;
|
2015-12-21 15:29:19 +01:00
|
|
|
|
2015-12-19 04:24:00 +01:00
|
|
|
if (keyCode === keys.DELETE ||
|
|
|
|
|
(keyCode === keys.D && e.ctrlKey === true)) {
|
2015-12-21 00:52:17 +01:00
|
|
|
var currentMeasurement = this;
|
2015-12-21 15:29:19 +01:00
|
|
|
var options = {
|
2016-01-10 15:40:51 +01:00
|
|
|
keyPressAllowed: false,
|
|
|
|
|
title: 'Remove measurement?',
|
|
|
|
|
text: 'Are you sure you would like to remove the entire measurement?'
|
2015-12-21 15:29:19 +01:00
|
|
|
};
|
2015-12-19 04:24:00 +01:00
|
|
|
|
|
|
|
|
showConfirmDialog(function() {
|
2016-01-11 11:32:20 +01:00
|
|
|
Meteor.call('removeMeasurement', currentMeasurement._id, function(error, response) {
|
2015-12-21 15:29:19 +01:00
|
|
|
if (error) {
|
|
|
|
|
log.warn(error);
|
|
|
|
|
}
|
2015-12-21 00:52:17 +01:00
|
|
|
});
|
2015-12-21 15:29:19 +01:00
|
|
|
}, options);
|
2015-12-19 04:24:00 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|