Fix user account menu background color. Add helper to responsively style modality text

This commit is contained in:
Erik Ziegler committed 2016-08-14 15:36:21 +02:00
1 parent 5c41556965
commit d70439c12d
4 files changed
+51 -15

No files matched your search

@@ -34,6 +34,39 @@ Template.studyTimepointStudy.onRendered(() => {
}
});
Template.studyTimepointStudy.helpers({
modalities() {
const instance = Template.instance();
let modalities = instance.data.study.modalities;
// Replace backslashes with spaces
return modalities.replace(/\\/g, ' ');
},
modalityStyle() {
// Responsively styles the Modality Acronyms for studies
// with more than one modality
const instance = Template.instance();
const modalities = instance.data.study.modalities;
const numModalities = modalities.split(/\\/g).length;
if (numModalities === 1) {
// If we have only one modality, it should take up the whole
// div.
return 'font-size: 1vw';
} else if (numModalities === 2) {
// If we have two, let them sit side-by-side
return 'font-size: 0.75vw';
} 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 + 'vh';
}
}
});
Template.studyTimepointStudy.events({
// Recalculates the timepoint height to make CSS transition smoother
'transitionend .studyTimepointThumbnails'(event, instance) {