Fixes for current case status and Lesion Tracker measurement table behaviour (LT-248)

This commit is contained in:
Erik Ziegler committed 2016-08-15 11:29:49 +02:00
1 parent d70439c12d
commit 62f102617f
17 files changed
+244 -92

No files matched your search

@@ -1,14 +1,16 @@
<template name="lesionTableHeaderRow">
<div class="lesionTableHeaderRow">
{{ #if anyUnmarkedLesionsLeft}}
<div class="add js-setTool">
<svg>
<use xlink:href=/packages/viewerbase/assets/icons.svg#icon-ui-add></use>
</svg>
</div>
{{ /if }}
<div class="type">
{{type}}
</div>
<div class="max">
<div class="max {{ # if gt numberOfLesions maxNumLesions }}warning{{/if}}">
{{ #if maxNumLesions }}
<p class="maxNumLesions">
Max {{maxNumLesions}}
@@ -1,3 +1,5 @@
import { MeasurementApi } from 'meteor/lesiontracker/client/api/measurement';
const toolTypesById = {
target: 'bidirectional',
nonTarget: 'nonTarget',
@@ -14,21 +16,14 @@ Template.lesionTableHeaderRow.onCreated(() => {
const instance = Template.instance();
instance.maxNumLesions = new ReactiveVar();
const current = instance.data.timepointApi.current();
const timepointType = current.timepointType;
if (!instance.data.currentTimepointId) {
console.warn('Case has no timepointId');
return;
}
// Give the header a proper name
instance.data.type = namesById[instance.data.id];
const currentTimepointId = instance.data.currentTimepointId;
const timepoint = Timepoints.findOne({
timepointId: currentTimepointId
});
const timepointType = timepoint.timepointType;
// TODO: Check if we have criteria where maximum limits are applied to
// Non-Targets and/or New Lesions
if (timepointType === 'baseline' && instance.data.id === 'target') {
@@ -57,17 +52,35 @@ Template.lesionTableHeaderRow.onCreated(() => {
});
Template.lesionTableHeaderRow.helpers({
numberOfLesions: function() {
const instance = Template.instance();
return instance.data.measurements.count();
type() {
// Give the header a proper name
const id = Template.instance().data.id;
return namesById[id];
},
maxNumLesions: function() {
numberOfLesions() {
return Template.instance().data.measurements.length;
},
maxNumLesions() {
return Template.instance().maxNumLesions.get();
},
anyUnmarkedLesionsLeft() {
const id = Template.instance().data.id;
if (id === 'target') {
return MeasurementApi.unmarkedTargets().length;
} else if (id === 'nonTarget') {
return MeasurementApi.unmarkedNonTargets().length;
}
// Keep the 'Add' button for the New Lesions header row
return true;
}
});
Template.lesionTableHeaderRow.events({
'click .js-setTool': function(event, instance) {
'click .js-setTool'(event, instance) {
const id = instance.data.id;
const toolType = toolTypesById[id];
toolManager.setActiveTool(toolType);
@@ -63,7 +63,7 @@ $headerRowHeight = 63px
text-align: right
.maxNumLesions
background-color: $textSecondaryColor;
background-color: $textSecondaryColor
border-radius: 3px
color: black
display: table
@@ -75,3 +75,9 @@ $headerRowHeight = 63px
margin-top: 22px
padding: 2px 6px 0
text-transform: uppercase
transition($sidebarTransition)
&.warning
.maxNumLesions
color: $textPrimaryColor
background-color: $uiYellow