LT-251: Showing only the active timepoint and creating 'Show additional timepoints' button and behavior

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2016-07-22 11:08:27 +02:00
1 parent b6cb2051b8
commit 4b307598e9
12 files changed
+193 -154

No files matched your search

+32 -23
View File
@@ -1,55 +1,64 @@
Template.registerHelper('choose', function() {
let result;
_.each(_.initial(arguments, 1), function(value) {
return value && (result = value);
});
return result;
});
/**
* Global Blaze UI helpers to work with logical operations
*/
Template.registerHelper('bool', function(value) {
// Convert any value into a boolean value
Template.registerHelper('bool', value => {
return !!value;
});
Template.registerHelper('eq', function(a, b) {
// Check if two values are identical
Template.registerHelper('eq', (a, b) => {
return a === b;
});
Template.registerHelper('ne', function(a, b) {
// Check if two values are different
Template.registerHelper('ne', (a, b) => {
return a === b;
});
Template.registerHelper('gt', function(a, b) {
// Check if the first value is greater than the second one
Template.registerHelper('gt', (a, b) => {
return a > b;
});
Template.registerHelper('lt', function(a, b) {
// Check if the first value is lesser than the second one
Template.registerHelper('lt', (a, b) => {
return a < b;
});
Template.registerHelper('gte', function(a, b) {
// Check if the first value is greater than or equals the second one
Template.registerHelper('gte', (a, b) => {
return a >= b;
});
Template.registerHelper('lte', function(a, b) {
// Check if the first value is lesser than or equals the second one
Template.registerHelper('lte', (a, b) => {
return a <= b;
});
Template.registerHelper('not', function(value) {
// Get the boolean negation for the given value
Template.registerHelper('not', value => {
return !value;
});
Template.registerHelper('and', function() {
// Check if all the given values are true
Template.registerHelper('and', (...values) => {
let result = true;
_.each(_.initial(arguments, 1), function(value) {
return value || (result = false);
});
_.each(_.initial(values, 1), value => value || (result = false));
return result;
});
Template.registerHelper('or', function() {
// Check if one of the given values is true
Template.registerHelper('or', (...values) => {
let result = false;
_.each(_.initial(arguments, 1), function(value) {
return value && (result = true);
});
_.each(_.initial(values, 1), value => value && (result = true));
return result;
});
// Choose the first truthy value in the given values
Template.registerHelper('choose', (...values) => {
let result;
_.each(_.initial(values, 1), value => value && (result = value));
return result;
});
@@ -0,0 +1,20 @@
/**
* A global Blaze UI helper to get the thumbnails for the given study
*/
Template.registerHelper('studyThumbnails', study => {
// Creates the series stacks
const stacks = createStacks(study);
// Defines the resulting thumbnails list
const thumbnails = [];
// Iterate over the stacks and add one by one with its index
_.each(stacks, (stack, index) => {
thumbnails.push({
thumbnailIndex: index,
stack: stack
});
});
return thumbnails;
});