Made lesion removal confirmation dialogs different for timepoints and complete measurments

This commit is contained in:
Erik Ziegler 2016-01-10 15:40:51 +01:00
parent a1618438d8
commit a9266608d2
4 changed files with 27 additions and 5 deletions

View File

@ -1,7 +1,15 @@
<template name="confirmDeleteDialog"> <template name="confirmDeleteDialog">
<div id="confirmDeleteDialog" tabindex="0"> <div id="confirmDeleteDialog" tabindex="0">
<h5>Remove Measurement?</h5> {{ #if title }}
<p>Are you sure you would like to remove this measurement?</p> <h5>{{title}}</h5>
{{ else }}
<h5>Remove data from Timepoint?</h5>
{{/if}}
{{ #if text }}
<p>{{text}}</p>
{{ else }}
<p>Are you sure you would like to remove the measurement data at this timepoint?</p>
{{/if}}
<button id="cancel" class="btn btn-link" tabindex="1">Cancel</button> <button id="cancel" class="btn btn-link" tabindex="1">Cancel</button>
<button id="confirm" class="btn btn-primary" tabindex="0">OK</button> <button id="confirm" class="btn btn-primary" tabindex="0">OK</button>
</div> </div>

View File

@ -17,12 +17,18 @@ showConfirmDialog = function(doneCallback, options) {
options = options || {}; options = options || {};
UI.renderWithData(Template.removableBackdrop, options, document.body); UI.renderWithData(Template.removableBackdrop, options, document.body);
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 // Make sure the context menu is closed when the user clicks away
$(".removableBackdrop").one('mousedown touchstart', function() { $(".removableBackdrop").one('mousedown touchstart', function() {
closeHandler(); closeHandler();
}); });
var confirmDeleteDialog = $("#confirmDeleteDialog"); confirmDeleteDialog = $("#confirmDeleteDialog");
confirmDeleteDialog.css('display', 'block'); confirmDeleteDialog.css('display', 'block');
confirmDeleteDialog.focus(); confirmDeleteDialog.focus();

View File

@ -238,12 +238,18 @@ Template.lesionLocationDialog.events({
var doneCallback = Template.lesionLocationDialog.doneCallback; var doneCallback = Template.lesionLocationDialog.doneCallback;
var dialog = Template.lesionLocationDialog.dialog; var dialog = Template.lesionLocationDialog.dialog;
var options = {
keyPressAllowed: false,
title: 'Remove measurement?',
text: 'Are you sure you would like to remove the entire measurement?'
};
showConfirmDialog(function() { showConfirmDialog(function() {
if (doneCallback && typeof doneCallback === 'function') { if (doneCallback && typeof doneCallback === 'function') {
var deleteTool = true; var deleteTool = true;
doneCallback(measurementData, deleteTool); doneCallback(measurementData, deleteTool);
} }
}); }, options);
closeHandler(dialog); closeHandler(dialog);
}, },

View File

@ -41,7 +41,9 @@ Template.lesionTableRow.events({
(keyCode === keys.D && e.ctrlKey === true)) { (keyCode === keys.D && e.ctrlKey === true)) {
var currentMeasurement = this; var currentMeasurement = this;
var options = { var options = {
keyPressAllowed: false keyPressAllowed: false,
title: 'Remove measurement?',
text: 'Are you sure you would like to remove the entire measurement?'
}; };
showConfirmDialog(function() { showConfirmDialog(function() {