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,40 @@
import { Template } from 'meteor/templating';
import './radioOptionGroup.html';
Template.radioOptionGroup.onCreated(function radioOptionGroupOnCreated() {
let instance = this;
instance.currentSchema = this.data.currentSchema;
// Here we set this Template instance's state property to equal the input state data
// The purpose of this is to make our helpers and events more consistent across templates.
instance.state = this.data.state;
// Invalid keys comes from Trials schema
instance.invalidKeys = this.data.invalidKeys;
// Validation Context of registrationWorkflow
instance.validationContext = this.data.validationContext;
// isModified records whether or not the user has unsaved changes
instance.isModified = this.data.isModified;
});
Template.radioOptionGroup.events({
'change .js-form-update'(event, instance) {
const value = event.currentTarget.value;
const key = instance.data.key;
if (event.currentTarget.checked) {
instance.state.set(key, value);
}
}
});
Template.radioOptionGroup.helpers({
value() {
const instance = Template.instance();
const key = instance.data.key;
return instance.state.get(key);
}
});