Replacing switchToTab with routes

This commit is contained in:
Bruno Alves de Faria committed 2017-03-21 10:16:47 -03:00
1 parent 0cf4dbf13f
commit 7718d31a77
46 files changed
+358 -753

No files matched your search

@@ -11,7 +11,7 @@ Template.dialogStudyAssociation.onCreated(() => {
instance.data.confirmCallback = (formData, resolve) => {
OHIF.log.info('Saving associations');
const Timepoints = StudyList.timepointApi.timepoints;
const Timepoints = OHIF.studylist.timepointApi.timepoints;
// Find the rows of the study association table
const $tableRows = instance.$('#studyAssociationTable table tbody tr');
@@ -138,7 +138,7 @@ Template.dialogStudyAssociation.onCreated(() => {
};
});
StudyList.timepointApi.storeTimepoints();
OHIF.studylist.timepointApi.storeTimepoints();
resolve();
};
@@ -52,7 +52,7 @@ function autoSelectStudies(selectedStudies) {
// Fetch autoselected studies based on the date range
// Note that we used MongoDB's fetch here so we have a mutable array,
// rather than a Cursor
const autoselected = StudyListStudies.find({
const autoselected = OHIF.studylist.collections.Studies.find({
studyDate: {
$gte: range.earliestDate.format('YYYYMMDD'),
$lte: range.latestDate.format('YYYYMMDD')
@@ -12,7 +12,7 @@ const getAssociationAssessment = () => {
};
// check if timepointApi is available
const timepointApi = StudyList.timepointApi;
const timepointApi = OHIF.studylist.timepointApi;
if (timepointApi) {
// Get a Cursor pointing to the selected Studies from the StudyList
const selectedStudies = OHIF.studylist.getSelectedStudies();
@@ -46,10 +46,8 @@ const viewStudies = () => {
const studyInstanceUids = selectedStudies.map(study => study.studyInstanceUid);
const contentId = 'viewerTab';
ViewerData = window.ViewerData || ViewerData;
// Update the ViewerData global object
ViewerData[contentId] = {
// Update the OHIF.viewer.data global object
OHIF.viewer.data = {
contentId: contentId,
studyInstanceUids: studyInstanceUids
};
@@ -77,7 +75,7 @@ const removeTimepointAssociations = event => {
const selectedStudies = OHIF.studylist.getSelectedStudies();
// Find the Timepoint that was previously referenced
const timepointApi = StudyList.timepointApi;
const timepointApi = OHIF.studylist.timepointApi;
if (!timepointApi) {
OHIF.log.error('Remove Study/Timepoint Association: No Timepoint API found.');
return;
@@ -1,5 +1,5 @@
<template name="longitudinalStudyListStudy">
<tr class="studylistStudy noselect">
<tr class="studylistStudy noselect {{#if this.selected}}active{{/if}}">
<td>
{{#if reviewerTip}}
<i class="fa fa-exclamation-circle reviewerTip" data-toggle="tooltip" data-placement="bottom" title="{{reviewerTip}}"></i>
@@ -1,3 +1,7 @@
import { Meteor } from 'meteor/meteor';
import { Template } from 'meteor/templating';
import { OHIF } from 'meteor/ohif:core';
// Use Aldeed's meteor-template-extension package to replace the
// default StudyListStudy template.
// See https://github.com/aldeed/meteor-template-extension
@@ -9,7 +13,7 @@ Template.longitudinalStudyListStudy.replaces(defaultTemplate);
Template[defaultTemplate].helpers({
timepointName: function() {
const instance = Template.instance();
const timepointApi = StudyList.timepointApi;
const timepointApi = OHIF.studylist.timepointApi;
if (!timepointApi) {
return;
}
@@ -21,9 +25,10 @@ Template[defaultTemplate].helpers({
return timepointApi.name(timepoint);
},
reviewerTip: function() {
const instance = Template.instance();
const timepointApi = StudyList.timepointApi;
const timepointApi = OHIF.studylist.timepointApi;
if (!timepointApi) {
return;
}
@@ -33,10 +38,7 @@ Template[defaultTemplate].helpers({
return;
}
var timepointReviewers = Reviewers.findOne({
timepointId: timepoint.timepointId
});
const timepointReviewers = Reviewers.findOne({ timepointId: timepoint.timepointId });
if (!timepointReviewers) {
return;
}
@@ -50,7 +52,7 @@ function getReviewerTipText(reviewers) {
return;
}
var newReviewers = reviewers.filter(function(reviewer) {
const newReviewers = reviewers.filter(function(reviewer) {
return reviewer.userId !== Meteor.userId();
});
@@ -58,7 +60,7 @@ function getReviewerTipText(reviewers) {
return;
}
var tipText = 'The study is being reviewed by ';
let tipText = 'The study is being reviewed by ';
newReviewers.forEach(function(reviewer, index) {
if (reviewer.userId === Meteor.userId()) {
return;
@@ -1,7 +1,11 @@
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
import { OHIF } from 'meteor/ohif:core';
// Use Aldeed's meteor-template-extension package to replace the
// default viewportOverlay template.
// See https://github.com/aldeed/meteor-template-extension
var defaultTemplate = 'viewportOverlay';
const defaultTemplate = 'viewportOverlay';
Template.longitudinalViewportOverlay.replaces(defaultTemplate);
// Add the TimepointName helper to the default template. The
@@ -12,10 +16,8 @@ Template[defaultTemplate].helpers({
const studyInstanceUid = instance.data.studyInstanceUid;
// TODO: Find a better way to obtain the timepointApi from the viewer.js template
const timepointApi = StudyList.timepointApi;
if (!timepointApi) {
return;
}
const timepointApi = OHIF.studylist.timepointApi;
if (!timepointApi) return;
const timepoints = timepointApi.study(studyInstanceUid);
if (!timepoints || !timepoints.length) {
@@ -31,4 +33,4 @@ Template[defaultTemplate].helpers({
const linkedViewports = Session.get('StackImagePositionOffsetSynchronizerLinkedViewports') || [];
return (linkedViewports.indexOf(this.viewportIndex) !== -1);
}
});
});