Creating sidebar templates for studies/timepoints browsers

This commit is contained in:
Bruno Alves de Faria committed 2017-10-25 22:18:42 -02:00
1 parent d787ed2cb9
commit 3b629f9816
22 files changed
+261 -125

No files matched your search

@@ -2,6 +2,7 @@ import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Tracker } from 'meteor/tracker';
import { $ } from 'meteor/jquery';
import { _ } from 'meteor/underscore';
import { OHIF } from 'meteor/ohif:core';
Template.studyBrowserItem.onCreated(() => {
@@ -11,7 +12,7 @@ Template.studyBrowserItem.onCreated(() => {
instance.loading = new ReactiveVar(false);
const modalities = instance.data.studyInformation.modalities || 'UN';
instance.modalities = modalities.replace(/\\/g, ' ');
instance.modalities = _.uniq(modalities.split(/[^A-Za-z]+/g)).join(' ');
});
Template.studyBrowserItem.events({
@@ -27,7 +28,7 @@ Template.studyBrowserItem.events({
triggerClick();
} else {
instance.loading.set(true);
OHIF.studies.retrieveStudyMetadata(studyInformation.studyInstanceUid).then(() => {
OHIF.studies.loadStudy(studyInformation.studyInstanceUid).then(() => {
instance.loaded = true;
instance.loading.set(false);
$element.trigger('ohif.studies.study.load', studyInformation);
@@ -43,22 +44,19 @@ Template.studyBrowserItem.helpers({
},
modalityStyle() {
// Responsively styles the Modality Acronyms for studies
// with more than one modality
// Responsively styles the Modality Acronyms for studies with more than one modality
const instance = Template.instance();
const numModalities = instance.modalities.split(/\s/g).length;
if (numModalities === 1) {
// If we have only one modality, it should take up the whole div.
return 'font-size: 1em';
// If we have only one modality, it should take up the whole div
return 'font-size:1em';
} else if (numModalities === 2) {
// If we have two, let them sit side-by-side
return 'font-size: 0.75em';
// If we have two modalities, let them sit side-by-side
return 'font-size:0.7em';
} else {
// If we have more than two modalities, change the line height to display multiple rows,
// depending on the number of modalities we need to display.
const lineHeight = Math.ceil(numModalities / 2) * 1.2;
return 'line-height: ' + lineHeight + 'em';
// If we have more than two modalities, change the line height to display multiple rows
return 'font-size:0.7em;line-height:1.4em;padding-top:0.5em';
}
}
});