Applied JSCS and added JSCS/jsHint config files

This commit is contained in:
Erik Ziegler committed 2016-01-11 11:32:20 +01:00
1 parent a9266608d2
commit 90a16a8059
68 files changed
+24956 -6399

No files matched your search

@@ -1,9 +1,9 @@
function closeHandler() {
// Hide the lesion dialog
$("#confirmDeleteDialog").css('display', 'none');
$('#confirmDeleteDialog').css('display', 'none');
// Remove the backdrop
$(".removableBackdrop").remove();
$('.removableBackdrop').remove();
// Remove the callback from the template data
delete Template.confirmDeleteDialog.doneCallback;
@@ -17,18 +17,18 @@ showConfirmDialog = function(doneCallback, options) {
options = options || {};
UI.renderWithData(Template.removableBackdrop, options, document.body);
var confirmDeleteDialog = $("#confirmDeleteDialog");
var confirmDeleteDialog = $('#confirmDeleteDialog');
confirmDeleteDialog.remove();
var viewer = document.getElementById('viewer');
UI.renderWithData(Template.confirmDeleteDialog, options, viewer);
// Make sure the context menu is closed when the user clicks away
$(".removableBackdrop").one('mousedown touchstart', function() {
$('.removableBackdrop').one('mousedown touchstart', function() {
closeHandler();
});
confirmDeleteDialog = $("#confirmDeleteDialog");
confirmDeleteDialog = $('#confirmDeleteDialog');
confirmDeleteDialog.css('display', 'block');
confirmDeleteDialog.focus();
@@ -76,4 +76,4 @@ Template.confirmDeleteDialog.events({
closeHandler();
}
}
});
});
@@ -3,7 +3,7 @@ function closeHandler(dialog) {
$(dialog).css('display', 'none');
// Remove the backdrop
$(".removableBackdrop").remove();
$('.removableBackdrop').remove();
// Restore the focus to the active viewport
setFocusToActiveViewport();
@@ -17,7 +17,9 @@ function setLesionNumberCallback(measurementData, eventData, doneCallback) {
var imageId = enabledElement.image.imageId;
var study = cornerstoneTools.metaData.get('study', imageId);
var timepoint = Timepoints.findOne({timepointName: study.studyDate});
var timepoint = Timepoints.findOne({
timepointName: study.studyDate
});
if (!timepoint) {
return;
}
@@ -26,7 +28,7 @@ function setLesionNumberCallback(measurementData, eventData, doneCallback) {
// Get a lesion number for this lesion, depending on whether or not the same lesion previously
// exists at a different timepoint
var lesionNumber = LesionManager.getNewLesionNumber(measurementData.timepointID, isTarget=true);
var lesionNumber = LesionManager.getNewLesionNumber(measurementData.timepointID, isTarget = true);
measurementData.lesionNumber = lesionNumber;
// Set lesion number
@@ -43,20 +45,20 @@ function getLesionLocationCallback(measurementData, eventData) {
Template.lesionLocationDialog.doneCallback = undefined;
// Get the lesion location dialog
var dialog = $("#lesionLocationDialog");
var dialog = $('#lesionLocationDialog');
Template.lesionLocationDialog.dialog = dialog;
// Show the backdrop
UI.render(Template.removableBackdrop, document.body);
// Make sure the context menu is closed when the user clicks away
$(".removableBackdrop").one('mousedown touchstart', function() {
$('.removableBackdrop').one('mousedown touchstart', function() {
closeHandler(dialog);
});
// Select the first option for now
var selector = dialog.find("select.selectLesionLocation");
selector.find("option:first").prop("selected", true);
var selector = dialog.find('select.selectLesionLocation');
selector.find('option:first').prop('selected', true);
// Find out if this lesion number is already added in the lesion manager for another timepoint
// If it is, stop here because we don't need the dialog.
@@ -73,7 +75,7 @@ function getLesionLocationCallback(measurementData, eventData) {
// If it isn't, continue to open the dialog and have the user choose a lesion location
// Show the lesion location dialog above
var dialogProperty = {
var dialogProperty = {
top: eventData.currentPoints.page.y - dialog.outerHeight() - 40,
left: eventData.currentPoints.page.x - dialog.outerWidth() / 2,
display: 'block'
@@ -91,7 +93,7 @@ function getLesionLocationCallback(measurementData, eventData) {
// If device is touch device, set position center of screen vertically and horizontally
if (isTouchDevice()) {
// add dialogMobile class to provide a black,transparent background
dialog.addClass("dialogMobile");
dialog.addClass('dialogMobile');
dialogProperty.top = 0;
dialogProperty.left = 0;
dialogProperty.right = 0;
@@ -107,14 +109,14 @@ changeLesionLocationCallback = function(measurementData, eventData, doneCallback
Template.lesionLocationDialog.doneCallback = doneCallback;
// Get the lesion location dialog
var dialog = $("#lesionLocationRelabelDialog");
var dialog = $('#lesionLocationRelabelDialog');
Template.lesionLocationDialog.dialog = dialog;
// Show the backdrop
UI.render(Template.removableBackdrop, document.body);
// Make sure the context menu is closed when the user clicks away
$(".removableBackdrop").one('mousedown touchstart', function() {
$('.removableBackdrop').one('mousedown touchstart', function() {
closeHandler(dialog);
});
@@ -127,7 +129,7 @@ changeLesionLocationCallback = function(measurementData, eventData, doneCallback
// If device is touch device, set position center of screen vertically and horizontally
if (!eventData || isTouchDevice()) {
// add dialogMobile class to provide a black,transparent background
dialog.addClass("dialogMobile");
dialog.addClass('dialogMobile');
dialogProperty.top = 0;
dialogProperty.left = 0;
dialogProperty.right = 0;
@@ -146,8 +148,14 @@ changeLesionLocationCallback = function(measurementData, eventData, doneCallback
}
LesionLocations.update({},
{$set: {selected: false}},
{ multi: true });
{
$set: {
selected: false
}
},
{
multi: true
});
var currentLocation = LesionLocations.findOne({
id: measurement.locationId
@@ -188,10 +196,14 @@ Template.lesionLocationDialog.events({
}
// Get selected location data
var locationObj = LesionLocations.findOne({_id: selectedOptionId});
var locationObj = LesionLocations.findOne({
_id: selectedOptionId
});
var id;
var existingLocation = PatientLocations.findOne({location: locationObj.location});
var existingLocation = PatientLocations.findOne({
location: locationObj.location
});
if (existingLocation) {
id = existingLocation._id;
} else {
@@ -269,7 +281,7 @@ Template.lesionLocationDialog.events({
});
Template.lesionLocationDialog.helpers({
'lesionLocations': function() {
lesionLocations: function() {
return LesionLocations.find();
}
});
});
@@ -1,5 +1,5 @@
Template.lesionTable.helpers({
'measurement': function() {
measurement: function() {
// All Targets shall be listed first followed by Non-Targets
return Measurements.find({}, {
sort: {
@@ -8,7 +8,7 @@ Template.lesionTable.helpers({
}
});
},
'timepoints': function() {
timepoints: function() {
return Timepoints.find({}, {
sort: {
timepointName: 1
@@ -49,10 +49,10 @@ Template.lesionTable.events({
height: newHeight
});
var viewportAndLesionTableHeight = $("#viewportAndLesionTable").height();
var viewportAndLesionTableHeight = $('#viewportAndLesionTable').height();
var newPercentageHeightofLesionTable = (startHeight - topPosition) / viewportAndLesionTableHeight * 100;
var newPercentageHeightofViewermain = 100 - newPercentageHeightofLesionTable;
$(".viewerMain").height(newPercentageHeightofViewermain + "%");
$('.viewerMain').height(newPercentageHeightofViewermain + '%');
// Resize viewport
resizeViewportElements();
@@ -71,19 +71,19 @@ Template.lesionTable.onRendered(function() {
// Put a visual indicator (<) in timepoint header in lesion table for active timepoints
// timepointLoaded property is used to put indicator for loaded timepoints in viewport
self.autorun(function() {
var ViewerData = Session.get("ViewerData");
var contentId = Session.get("activeContentId");
var ViewerData = Session.get('ViewerData');
var contentId = Session.get('activeContentId');
if (contentId) {
var viewerData = ViewerData[contentId];
if (viewerData) {
if (viewerData.loadedSeriesData) {
// Get study dates of imageViewerViewport elements
var loadedStudyDates = {
patientId: "",
patientId: '',
dates: []
};
$(".imageViewerViewport").each(function(viewportIndex, element) {
$('.imageViewerViewport').each(function(viewportIndex, element) {
var enabledElement = cornerstone.getEnabledElement(element);
if (!enabledElement || !enabledElement.image) {
return;
@@ -125,4 +125,4 @@ Template.lesionTable.onRendered(function() {
}
});
});
});
@@ -1,6 +1,10 @@
Template.lesionTableRow.helpers({
'timepoints': function() {
return Timepoints.find({}, {sort: {timepointName: 1}});
timepoints: function() {
return Timepoints.find({}, {
sort: {
timepointName: 1
}
});
}
});
@@ -9,7 +13,7 @@ function doneCallback(measurementData, deleteTool) {
// opened by the Lesion Table, we should clear the data for
// the specified Timepoint Cell
if (deleteTool === true) {
Meteor.call("removeMeasurement", measurementData.id, function(error, response) {
Meteor.call('removeMeasurement', measurementData.id, function(error, response) {
if (error) {
log.warn(error);
}
@@ -47,7 +51,7 @@ Template.lesionTableRow.events({
};
showConfirmDialog(function() {
Meteor.call("removeMeasurement", currentMeasurement._id, function(error, response) {
Meteor.call('removeMeasurement', currentMeasurement._id, function(error, response) {
if (error) {
log.warn(error);
}
@@ -1,5 +1,5 @@
Template.lesionTableTimepointCell.helpers({
'hasDataAtThisTimepoint': function() {
hasDataAtThisTimepoint: function() {
// This simple function just checks whether or not timepoint data
// exists for this Measurement at this Timepoint
var lesionData = Template.parentData(1);
@@ -7,7 +7,7 @@ Template.lesionTableTimepointCell.helpers({
lesionData.timepoints &&
lesionData.timepoints[this.timepointID]);
},
'displayData': function() {
displayData: function() {
// Search Measurements by lesion and timepoint
var lesionData = Template.parentData(1);
if (!lesionData ||
@@ -20,7 +20,7 @@ Template.lesionTableTimepointCell.helpers({
if (lesionData.isTarget === true) {
if (data.shortestDiameter) {
return data.longestDiameter + " x " + data.shortestDiameter;
return data.longestDiameter + ' x ' + data.shortestDiameter;
}
return data.longestDiameter;
@@ -28,7 +28,7 @@ Template.lesionTableTimepointCell.helpers({
return data.response;
}
},
'isTarget': function() {
isTarget: function() {
var lesionData = Template.parentData(1);
return lesionData.isTarget;
}
@@ -90,4 +90,4 @@ Template.lesionTableTimepointCell.events({
});
}
}
});
});
@@ -1,23 +1,26 @@
Template.lesionTableTimepointHeader.events({
'click th': function(e, template){
'click th.lesionTableTimepointCell': function(e, template) {
var parentPosition = getPosition(e.currentTarget);
var cellText = e.currentTarget.innerText;
// Remove spaces in string
cellText = cellText.replace(/\s/g, ''); // Remove spaces
cellText = cellText.replace('<', ''); // Remove <
var splitCellText = cellText.split('/');
var dateStr = splitCellText[2].replace(/\D/g,'') + "" + splitCellText[0].replace(/\D/g,'') + ""+splitCellText[1].replace(/\D/g,''); // Remove non-digit chars
var dateStr = splitCellText[2].replace(/\D/g,'') + '' + splitCellText[0].replace(/\D/g,'') + '' + splitCellText[1].replace(/\D/g,''); // Remove non-digit chars
// Check patient has a timepointText as Baseline
var patientId = template.data.patientId;
// Open popup
var timepointTextDialog = $("#timepointTextDialog");
var dialogDisplay = timepointTextDialog.css("display");
if(dialogDisplay === "none") {
var isBaselineInCollection = Timepoints.findOne({patientId: patientId, timepointName: dateStr, timepointText: "Baseline"});
var timepointTextDialog = $('#timepointTextDialog');
var dialogDisplay = timepointTextDialog.css('display');
if (dialogDisplay === 'none') {
var isBaselineInCollection = Timepoints.findOne({
patientId: patientId,
timepointName: dateStr,
timepointText: 'Baseline'
});
// If isBaselineInCollection is true, "Baseline" is found in collection for patient and set checkbox as checked
if (isBaselineInCollection) {
@@ -29,30 +32,31 @@ Template.lesionTableTimepointHeader.events({
}
// Open dialog
var dialogProperty = {
var dialogProperty = {
top: parentPosition.y - 30,
left: parentPosition.x,
display: 'block'
};
timepointTextDialog.css(dialogProperty);
} else if(dialogDisplay === "block") {
} else {
// Get timepoints of patient
// Set timepointText as Baseline for selected timepoint
var timepoints = Timepoints.find({patientId: patientId}).fetch();
var timepoints = Timepoints.find({
patientId: patientId
}).fetch();
// Check checkbox is selected
var checkboxBaselineChecked = $("#checkBoxBaseline").is(":checked");
var checkboxBaselineChecked = $('#checkBoxBaseline').is(':checked');
timepoints.forEach(function(timepoint) {
// timepointText defines a custom text for timepoint such as Baseline, Nadir, Current
if (timepoint.timepointName === dateStr) {
// If checkbox is selected, set timepointText as Baseline
// Else set timepointText as ""
var timepointText = "Baseline";
if(!checkboxBaselineChecked) {
timepointText = "";
var timepointText = 'Baseline';
if (!checkboxBaselineChecked) {
timepointText = '';
}
Timepoints.update(timepoint._id,{
@@ -60,36 +64,29 @@ Template.lesionTableTimepointHeader.events({
timepointText: timepointText
}
});
} else{
} else {
// Set timepointText as empty
Timepoints.update(timepoint._id,{
$set: {
timepointText: ""
timepointText: ''
}
});
}
});
// Close dialog
timepointTextDialog.css("display", "none");
timepointTextDialog.css('display', 'none');
}
}
});
Template.lesionTableTimepointHeader.helpers({
'timepointTextFound': function(){
timepointTextFound: function() {
var timepointText = this.timepointText;
if(timepointText && timepointText === 'Baseline') {
return true;
}
return false;
return (timepointText && timepointText === 'Baseline');
}
});
// Gets parent's position of element which mouse pointer is clicked in
function getPosition(element) {
var xPosition = 0;
@@ -100,5 +97,9 @@ function getPosition(element) {
yPosition += (element.offsetTop - element.scrollTop + element.clientTop);
element = element.offsetParent;
}
return { x: xPosition, y: yPosition };
}
return {
x: xPosition,
y: yPosition
};
}
@@ -3,7 +3,7 @@ function closeHandler(dialog) {
$(dialog).css('display', 'none');
// Remove the backdrop
$(".removableBackdrop").remove();
$('.removableBackdrop').remove();
// Restore the focus to the active viewport
setFocusToActiveViewport();
@@ -17,7 +17,9 @@ function setLesionNumberCallback(measurementData, eventData, doneCallback) {
var imageId = enabledElement.image.imageId;
var study = cornerstoneTools.metaData.get('study', imageId);
var timepoint = Timepoints.findOne({timepointName: study.studyDate});
var timepoint = Timepoints.findOne({
timepointName: study.studyDate
});
if (!timepoint) {
return;
}
@@ -29,7 +31,7 @@ function setLesionNumberCallback(measurementData, eventData, doneCallback) {
// Get a lesion number for this lesion, depending on whether or not the same lesion previously
// exists at a different timepoint
var lesionNumber = LesionManager.getNewLesionNumber(measurementData.timepointID, isTarget=false);
var lesionNumber = LesionManager.getNewLesionNumber(measurementData.timepointID, isTarget = false);
measurementData.lesionNumber = lesionNumber;
// Set lesion number
@@ -43,26 +45,26 @@ function getLesionLocationCallback(measurementData, eventData) {
Template.nonTargetLesionDialog.measurementData = measurementData;
// Get the non-target lesion location dialog
var dialog = $("#nonTargetLesionLocationDialog");
var dialog = $('#nonTargetLesionLocationDialog');
Template.nonTargetLesionDialog.dialog = dialog;
// Show the backdrop
UI.render(Template.removableBackdrop, document.body);
// Make sure the context menu is closed when the user clicks away
$(".removableBackdrop").one('mousedown touchstart', function() {
$('.removableBackdrop').one('mousedown touchstart', function() {
closeHandler(dialog);
});
// Find the select option box
var selectorLocation = dialog.find("select#selectNonTargetLesionLocation");
var selectorResponse = dialog.find("select#selectNonTargetLesionLocationResponse");
var selectorLocation = dialog.find('select#selectNonTargetLesionLocation');
var selectorResponse = dialog.find('select#selectNonTargetLesionLocationResponse');
selectorLocation.find("option:first").prop("selected", "selected");
selectorResponse.find("option:first").prop("selected", "selected");
selectorLocation.find('option:first').prop('selected', 'selected');
selectorResponse.find('option:first').prop('selected', 'selected');
// Allow location selection
selectorLocation.removeAttr("disabled");
selectorLocation.removeAttr('disabled');
// Find out if this lesion number is already added in the lesion manager for another timepoint
// If it is, disable selector location
@@ -83,15 +85,15 @@ function getLesionLocationCallback(measurementData, eventData) {
selectorLocation.find('option').each(function() {
if ($(this).text() === locationName) {
// Select location in locations dropdown list
selectorLocation.find('option').eq($(this).index()).prop("selected", true);
selectorLocation.find('option').eq($(this).index()).prop('selected', true);
}
});
selectorLocation.prop("disabled", true);
selectorLocation.prop('disabled', true);
}
// Show the nonTargetLesion dialog above
var dialogProperty = {
var dialogProperty = {
top: eventData.currentPoints.page.y - dialog.outerHeight() - 40,
left: eventData.currentPoints.page.x - dialog.outerWidth() / 2,
display: 'block'
@@ -109,7 +111,7 @@ function getLesionLocationCallback(measurementData, eventData) {
// If device is touch device, set position center of screen vertically and horizontally
if (isTouchDevice()) {
// add dialogMobile class to provide a black,transparent background
dialog.addClass("dialogMobile");
dialog.addClass('dialogMobile');
dialogProperty.top = 0;
dialogProperty.left = 0;
dialogProperty.right = 0;
@@ -125,14 +127,14 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
Template.nonTargetLesionDialog.doneCallback = doneCallback;
// Get the non-target lesion location dialog
var dialog = $("#nonTargetLesionRelabelDialog");
var dialog = $('#nonTargetLesionRelabelDialog');
Template.nonTargetLesionDialog.dialog = dialog;
// Show the backdrop
UI.render(Template.removableBackdrop, document.body);
// Make sure the context menu is closed when the user clicks away
$(".removableBackdrop").one('mousedown touchstart', function() {
$('.removableBackdrop').one('mousedown touchstart', function() {
closeHandler(dialog);
if (doneCallback && typeof doneCallback === 'function') {
@@ -142,17 +144,17 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
});
// Find the select option box
var selectorLocation = dialog.find("select#selectNonTargetLesionLocation");
var selectorResponse = dialog.find("select#selectNonTargetLesionLocationResponse");
var selectorLocation = dialog.find('select#selectNonTargetLesionLocation');
var selectorResponse = dialog.find('select#selectNonTargetLesionLocationResponse');
selectorLocation.find("option:first").prop("selected", "selected");
selectorResponse.find("option:first").prop("selected", "selected");
selectorLocation.find('option:first').prop('selected', 'selected');
selectorResponse.find('option:first').prop('selected', 'selected');
// Allow location selection
selectorLocation.removeAttr("disabled");
selectorLocation.removeAttr('disabled');
// Show the nonTargetLesion dialog above
var dialogProperty = {
var dialogProperty = {
display: 'block'
};
@@ -160,7 +162,7 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
// If device is touch device, set position center of screen vertically and horizontally
if (!eventData || isTouchDevice()) {
// add dialogMobile class to provide a black,transparent background
dialog.addClass("dialogMobile");
dialog.addClass('dialogMobile');
dialogProperty.top = 0;
dialogProperty.left = 0;
dialogProperty.right = 0;
@@ -179,8 +181,14 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
}
LesionLocations.update({},
{$set: {selected: false}},
{ multi: true });
{
$set: {
selected: false
}
},
{
multi: true
});
var currentLocation = LesionLocations.findOne({
id: measurement.locationId
@@ -197,8 +205,14 @@ changeNonTargetLocationCallback = function(measurementData, eventData, doneCallb
});
LocationResponses.update({},
{$set: {selected: false}},
{ multi: true });
{
$set: {
selected: false
}
},
{
multi: true
});
var response = measurement.timepoints[measurementData.timepointID].response;
@@ -233,12 +247,12 @@ Template.nonTargetLesionDialog.events({
var measurementData = Template.nonTargetLesionDialog.measurementData;
// Find the select option box
var selectorLocation = dialog.find("select#selectNonTargetLesionLocation");
var selectorResponse = dialog.find("select#selectNonTargetLesionLocationResponse");
var selectorLocation = dialog.find('select#selectNonTargetLesionLocation');
var selectorResponse = dialog.find('select#selectNonTargetLesionLocationResponse');
// Get the current value of the selector
var selectedOptionId = selectorLocation.find("option:selected").val();
var responseOptionId = selectorResponse.find("option:selected").val();
var selectedOptionId = selectorLocation.find('option:selected').val();
var responseOptionId = selectorResponse.find('option:selected').val();
// If the selected option is still the default (-1)
// then stop here
@@ -253,15 +267,21 @@ Template.nonTargetLesionDialog.events({
}
// Get selected location data
var locationObj = LesionLocations.findOne({_id: selectedOptionId});
var locationObj = LesionLocations.findOne({
_id: selectedOptionId
});
var id;
var existingLocation = PatientLocations.findOne({location: locationObj.location});
var existingLocation = PatientLocations.findOne({
location: locationObj.location
});
if (existingLocation) {
id = existingLocation._id;
} else {
// Adds location data to PatientLocation and retrieve the location ID
id = PatientLocations.insert({location: locationObj.location});
id = PatientLocations.insert({
location: locationObj.location
});
}
if (measurementData.id) {
@@ -323,12 +343,11 @@ Template.nonTargetLesionDialog.events({
}
});
Template.nonTargetLesionDialog.helpers({
'lesionLocations': function() {
lesionLocations: function() {
return LesionLocations.find();
},
'locationResponses': function() {
locationResponses: function() {
return LocationResponses.find();
}
});
});
@@ -3,7 +3,7 @@ function closeHandler(dialog) {
$(dialog).css('display', 'none');
// Remove the backdrop
$(".removableBackdrop").remove();
$('.removableBackdrop').remove();
// Restore the focus to the active viewport
setFocusToActiveViewport();
@@ -14,14 +14,14 @@ changeNonTargetResponse = function(measurementData, eventData, doneCallback) {
Template.nonTargetResponseDialog.doneCallback = doneCallback;
// Get the non-target lesion location dialog
var dialog = $("#nonTargetResponseDialog");
var dialog = $('#nonTargetResponseDialog');
Template.nonTargetResponseDialog.dialog = dialog;
// Show the backdrop
UI.render(Template.removableBackdrop, document.body);
// Make sure the context menu is closed when the user clicks away
$(".removableBackdrop").one('mousedown touchstart', function() {
$('.removableBackdrop').one('mousedown touchstart', function() {
closeHandler(dialog);
if (doneCallback && typeof doneCallback === 'function') {
@@ -31,7 +31,7 @@ changeNonTargetResponse = function(measurementData, eventData, doneCallback) {
});
// Show the nonTargetLesion dialog above
var dialogProperty = {
var dialogProperty = {
display: 'block'
};
@@ -39,7 +39,7 @@ changeNonTargetResponse = function(measurementData, eventData, doneCallback) {
// If device is touch device, set position center of screen vertically and horizontally
if (!eventData || isTouchDevice()) {
// add dialogMobile class to provide a black,transparent background
dialog.addClass("dialogMobile");
dialog.addClass('dialogMobile');
dialogProperty.top = 0;
dialogProperty.left = 0;
dialogProperty.right = 0;
@@ -90,10 +90,10 @@ Template.nonTargetResponseDialog.events({
var measurementData = Template.nonTargetResponseDialog.measurementData;
// Find the select option box
var selectorResponse = dialog.find("select#selectNonTargetLesionLocationResponse");
var selectorResponse = dialog.find('select#selectNonTargetLesionLocationResponse');
// Get the current value of the selector
var responseOptionId = selectorResponse.find("option:selected").val();
var responseOptionId = selectorResponse.find('option:selected').val();
// If the selected response option is still the default (-1)
// then stop here
@@ -148,9 +148,8 @@ Template.nonTargetResponseDialog.events({
}
});
Template.nonTargetResponseDialog.helpers({
'locationResponses': function() {
locationResponses: function() {
return LocationResponses.find();
}
});
});
@@ -12,10 +12,14 @@ Template.studyDateList.helpers({
// since the WorklistStudies Collection only contains the studies on-screen
// Check which study is currently loaded into the study browser
var currentStudyInBrowser = ViewerStudies.findOne({selected: true});
var currentStudyInBrowser = ViewerStudies.findOne({
selected: true
});
// Find studies which have the same patientId as the currently selected study
var relatedStudies = WorklistStudies.find({patientId: currentStudyInBrowser.patientId}).fetch();
var relatedStudies = WorklistStudies.find({
patientId: currentStudyInBrowser.patientId
}).fetch();
// Modify the array of related studies so the default option is the currently selected study
relatedStudies.forEach(function(study) {
@@ -31,7 +35,6 @@ Template.studyDateList.helpers({
}
});
Template.studyDateList.events({
/**
* When the study date selector combo box is changed, we will
@@ -65,16 +68,26 @@ Template.studyDateList.events({
// Set "Selected" to false for the entire collection
ViewerStudies.update({},
{$set: {selected: false}},
{ multi: true });
{
$set: {
selected: false
}
},
{
multi: true
});
// Check if this study already exists in the ViewerStudies collection
// of loaded studies. If it does, set it's 'selected' value to true.
var existingStudy = ViewerStudies.findOne({studyInstanceUid: studyInstanceUid});
var existingStudy = ViewerStudies.findOne({
studyInstanceUid: studyInstanceUid
});
if (existingStudy) {
// Set the current finding in the collection to true
ViewerStudies.update(existingStudy._id, {
$set: {selected: true}
$set: {
selected: true
}
});
return;
}
@@ -86,15 +99,17 @@ Template.studyDateList.events({
var timepointID = uuid.v4();
var timepoint = Timepoints.findOne({timepointName: study.studyDate});
var timepoint = Timepoints.findOne({
timepointName: study.studyDate
});
if (timepoint) {
log.warn("A timepoint with that study date already exists!");
log.warn('A timepoint with that study date already exists!');
return;
}
var testTimepoint = Timepoints.findOne({});
if (testTimepoint && testTimepoint.patientId !== study.patientId) {
log.warn("Timepoints collection related to the wrong subject");
log.warn('Timepoints collection related to the wrong subject');
return;
}