LT-298: Implementing rename behavior for measurement table

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2016-11-15 08:25:09 +01:00
1 parent 8a265b248a
commit 5c36074f8a
5 files changed
+37 -11

No files matched your search

@@ -1,5 +1,6 @@
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { OHIF } from 'meteor/ohif:core';
Template.caseProgress.onCreated(() => {
const instance = Template.instance();
@@ -81,6 +81,10 @@ Template.measureFlow.onRendered(() => {
instance.$('.measure-flow').bounded();
instance.$('.btn-add').focus();
if (instance.data.autoClick) {
instance.$('.btn-add').hide().trigger('click');
}
});
Template.measureFlow.events({
@@ -1,3 +1,5 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { OHIF } from 'meteor/ohif:core';
function doneCallback(measurementData, deleteTool) {
@@ -14,7 +16,7 @@ function doneCallback(measurementData, deleteTool) {
}
// Delete a lesion if Ctrl+D or DELETE is pressed while a lesion is selected
var keys = {
const keys = {
D: 68,
DELETE: 46
};
@@ -26,10 +28,25 @@ Template.measurementTableRow.events({
$row.toggleClass('active');
},
'dblclick .location': function() {
'click .js-rename'(event, instance) {
OHIF.measurements.toggleLabelButton({
instance,
measurementId: instance.data.rowItem.entries[0],
measurementTypeId: instance.data.rowItem.measurementTypeId,
element: document.body,
measurementApi: instance.data.measurementApi,
position: {
x: event.clientX,
y: event.clientY
},
autoClick: true
});
},
'dblclick .location'() {
OHIF.log.info('Double clicked on Lesion Location cell');
var measurementData = this;
const measurementData = this;
// TODO = Fix this weird issue? Need to set toolData's ID properly..
measurementData.id = this._id;
@@ -37,13 +54,13 @@ Template.measurementTableRow.events({
changeLesionLocationCallback(measurementData, null, doneCallback);
},
'keydown .location': function(e) {
var keyCode = e.which;
'keydown .location'(event) {
const keyCode = event.which;
if (keyCode === keys.DELETE ||
(keyCode === keys.D && e.ctrlKey === true)) {
var currentMeasurement = this;
var options = {
(keyCode === keys.D && event.ctrlKey === true)) {
const currentMeasurement = this;
const options = {
keyPressAllowed: false,
title: 'Remove measurement?',
text: 'Are you sure you would like to remove the entire measurement?'