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,38 @@
import { Template } from 'meteor/templating';
import './selectInput.html';
Template.selectInput.onCreated(function selectInputOnCreated() {
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.selectInput.helpers({
selectedOptionValue() {
const instance = Template.instance();
var key = instance.data.key;
return instance.state.get(key);
}
});
Template.selectInput.events({
'change .js-form-update'(event, instance) {
const value = $(event.currentTarget).val();
const key = instance.data.key;
instance.state.set(key, value);
}
});