LT-253: Added Collection to store Additional Findings in the database. Set up some form components that store temporary UI state

This commit is contained in:
Erik Ziegler committed 2016-07-22 11:12:04 +02:00
1 parent 022c534895
commit 40062e2e9d
35 files changed
+599 -216

No files matched your search

@@ -0,0 +1,10 @@
import { Template } from 'meteor/templating';
/**
* Compares two variables are equal in value
*
* @returns {boolean}
*/
Template.registerHelper('equals', function(a, b) {
return a === b;
});
@@ -0,0 +1,14 @@
import { Template } from 'meteor/templating';
Template.registerHelper('getSchema', function(context) {
const instance = Template.instance();
if (!instance.currentSchema) {
return;
}
if (!context) {
return;
}
return instance.currentSchema.schema(context);
});
@@ -0,0 +1,19 @@
import { Template } from 'meteor/templating';
/**
* A global Blaze UI helper function to return whether or not a key is part of the invalidKeys dictionary
*/
Template.registerHelper('isInvalidKey', function(context, format, options) {
if (!context) {
return;
}
const instance = Template.instance();
if (!instance.invalidKeys) {
return;
}
// Show error message if key is at first index
var firstInvalidKey = instance.invalidKeys.get(0);
return (firstInvalidKey && firstInvalidKey.name === context)
});
@@ -0,0 +1,28 @@
import { Template } from 'meteor/templating';
/**
* A global Blaze UI helper function to return whether or not a
* field is required based on the Template's specified currentSchema
*/
Template.registerHelper('stateDataWithKey', function(context) {
const instance = Template.instance();
if (!context) {
return {
state: instance.state,
invalidKeys: instance.invalidKeys,
validationContext: instance.validationContext,
currentSchema: instance.currentSchema,
isModified: instance.isModified
};
}
return {
key: context,
state: instance.state,
invalidKeys: instance.invalidKeys,
validationContext: instance.validationContext,
currentSchema: instance.currentSchema,
isModified: instance.isModified
};
});