LT-275: Moving the selectTree component to measurements package

This commit is contained in:
Bruno Alves de Faria authored and Erik Ziegler committed 2016-11-15 08:24:30 +01:00
1 parent dd9fa2b789
commit b1eb68521a
16 files changed
+14 -66

No files matched your search

@@ -0,0 +1,36 @@
import { OHIF } from 'meteor/ohif:core';
import { Template } from 'meteor/templating';
import { _ } from 'meteor/underscore';
Template.selectTreeCommon.events({
'click .select-tree-common label'(event, instance) {
// Get the clicked label
const $target = $(event.currentTarget);
// Build the input selector based on the label target
const inputSelector = '#' + $target.attr('for');
// Get the tree instance
const treeInstance = instance.data.treeInstance;
// Check if the input is not rendered
if (!$(inputSelector).length) {
// Change the search terms with the clicked label string
treeInstance.$('.tree-search input').val($target.text()).trigger('input');
// Wait for options rerendering
Tracker.afterFlush(() => {
// Wait for components initialization
Meteor.defer(() => $(inputSelector).click());
});
}
}
});
Template.selectTreeCommon.helpers({
// Get the common items
items() {
return Template.instance().data.treeInstance.getCommonItems();
}
});