Fix duplicate helper bugs in Lesion Tracker

This commit is contained in:
Erik Ziegler committed 2016-08-05 10:09:12 +02:00
1 parent 9bf96f24d7
commit f963fec586
19 files changed
+124 -181

No files matched your search

@@ -9,6 +9,10 @@ Template.baseComponent.constructView = function(contentFunc, elseFunc) {
// Get the data passed to the template
const data = Template.currentData();
if (!data) {
return;
}
// Check the base template. If it's not informed set as the custom base
data.base || (data.base = 'baseCustom');
+8 -2
View File
@@ -48,14 +48,20 @@ Template.registerHelper('not', value => {
// Check if all the given values are true
Template.registerHelper('and', (...values) => {
let result = true;
_.each(_.initial(values, 1), value => value || (result = false));
_.each(arguments, value => value || (result = false));
return result;
});
// Check if one of the given values is true
Template.registerHelper('or', (...values) => {
let result = false;
_.each(_.initial(values, 1), value => value && (result = true));
_.each(_.initial(values, 1), value => {
if (value instanceof Spacebars.kw) {
return;
}
return value && (result = true);
});
return result;
});