LT-249: Implementing behavior for 'comparison' and 'key timepoints' switch
This commit is contained in:
1 parent
ef89c3dfd7
commit
048bb3f050
11 files changed
+136
-93
No files matched your search
@@ -4,10 +4,10 @@
|
||||
{{>roundedButtonGroup buttonGroupData}}
|
||||
</div>
|
||||
<div class="lesionTableTimepointHeaderRow">
|
||||
{{#each timepoints}}
|
||||
{{#each timepoints.get}}
|
||||
{{>lesionTableTimepointHeader}}
|
||||
{{/each}}
|
||||
</div>
|
||||
{{>lesionTableView}}
|
||||
{{>lesionTableView this}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,48 +1,37 @@
|
||||
Template.lesionTable.helpers({
|
||||
timepoints: function() {
|
||||
return Timepoints.find({}, {
|
||||
Template.lesionTable.onCreated(() => {
|
||||
const instance = Template.instance();
|
||||
|
||||
instance.data.lesionTableLayout = new ReactiveVar('comparison');
|
||||
instance.data.timepoints = new ReactiveVar([]);
|
||||
|
||||
instance.autorun(() => {
|
||||
// Get the current table layout
|
||||
const tableLayout = instance.data.lesionTableLayout.get();
|
||||
|
||||
// Get all the timepoints
|
||||
const allTimepoints = Timepoints.find({}, {
|
||||
sort: {
|
||||
latestDate: 1
|
||||
latestDate: -1
|
||||
}
|
||||
});
|
||||
},
|
||||
}).fetch();
|
||||
|
||||
buttonGroupData() {
|
||||
const instance = Template.instance();
|
||||
return {
|
||||
value: instance.lesionTableLayout,
|
||||
options: [{
|
||||
value: 'comparison',
|
||||
text: 'Comparison'
|
||||
}, {
|
||||
value: 'key',
|
||||
text: 'Key Timepoints'
|
||||
}]
|
||||
};
|
||||
}
|
||||
});
|
||||
// Get the last 2 timepoints
|
||||
let timepoints = allTimepoints.slice(0, 2);
|
||||
|
||||
Template.lesionTable.events({
|
||||
/**
|
||||
* Retrieve the lesion id from the DOM data for this row
|
||||
*/
|
||||
/*'click table#tblLesion tbody tr': function(e, template) {
|
||||
var measurementId = $(e.currentTarget).data('measurementid');
|
||||
activateLesion(measurementId, template.data);
|
||||
},*/
|
||||
// Concatenate the baseline if the table layout is for key timepoints
|
||||
if (tableLayout === 'key' && allTimepoints.length > 2) {
|
||||
timepoints = timepoints.concat(_.last(allTimepoints));
|
||||
}
|
||||
|
||||
// Return key timepoints
|
||||
instance.data.timepoints.set(timepoints);
|
||||
});
|
||||
});
|
||||
|
||||
// Temporary until we have a real window manager with events for series/study changed
|
||||
Session.setDefault('NewSeriesLoaded', false);
|
||||
|
||||
Template.lesionTable.onCreated(function() {
|
||||
var instance = this;
|
||||
|
||||
instance.lesionTableLayout = new ReactiveVar();
|
||||
instance.lesionTableLayout.set('comparison');
|
||||
});
|
||||
|
||||
Template.lesionTable.onRendered(function() {
|
||||
Template.lesionTable.onRendered(() => {
|
||||
// Find the first measurement by Lesion Number
|
||||
var firstLesion = Measurements.findOne({}, {
|
||||
sort: {
|
||||
@@ -60,3 +49,33 @@ Template.lesionTable.onRendered(function() {
|
||||
activateLesion(firstLesion._id, templateData);
|
||||
}
|
||||
});
|
||||
|
||||
Template.lesionTable.events({
|
||||
/**
|
||||
* Retrieve the lesion id from the DOM data for this row
|
||||
*/
|
||||
/*'click table#tblLesion tbody tr': function(e, template) {
|
||||
var measurementId = $(e.currentTarget).data('measurementid');
|
||||
activateLesion(measurementId, template.data);
|
||||
},*/
|
||||
});
|
||||
|
||||
Template.lesionTable.helpers({
|
||||
dataContainer() {
|
||||
return {};
|
||||
},
|
||||
|
||||
buttonGroupData() {
|
||||
const instance = Template.instance();
|
||||
return {
|
||||
value: instance.data.lesionTableLayout,
|
||||
options: [{
|
||||
value: 'comparison',
|
||||
text: 'Comparison'
|
||||
}, {
|
||||
value: 'key',
|
||||
text: 'Key Timepoints'
|
||||
}]
|
||||
};
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user