LT-275: Adding fixed common labels to open source version
This commit is contained in:
parent
82b23f4368
commit
d5ecfbdd39
@ -56,30 +56,24 @@ Template.measureFlow.onCreated(() => {
|
||||
|
||||
const items = [
|
||||
'Adrenal',
|
||||
'Bladder',
|
||||
'Bone',
|
||||
'Brain',
|
||||
'Breast',
|
||||
'Colon',
|
||||
'Esophagus',
|
||||
'Extremities',
|
||||
'Gallbladder',
|
||||
'Kidney',
|
||||
'Liver',
|
||||
'Lung',
|
||||
'Lymph Node',
|
||||
'Muscle',
|
||||
'Bladder',
|
||||
'Neck',
|
||||
'Other: Soft Tissue',
|
||||
'Bone',
|
||||
'Other Soft Tissue',
|
||||
'Brain',
|
||||
'Ovary',
|
||||
'Breast',
|
||||
'Pancreas',
|
||||
'Pelvis',
|
||||
'Peritoneum/Omentum',
|
||||
'Colon',
|
||||
'Prostate',
|
||||
'Retroperitoneum',
|
||||
'Esophagus',
|
||||
'Small Bowel',
|
||||
'Extremities',
|
||||
'Spleen',
|
||||
'Gallbladder',
|
||||
'Stomach',
|
||||
'Kidney',
|
||||
'Subcutaneous'
|
||||
];
|
||||
|
||||
@ -90,6 +84,25 @@ Template.measureFlow.onCreated(() => {
|
||||
value: item
|
||||
});
|
||||
});
|
||||
|
||||
const commonItems = [
|
||||
'Abdomen/Chest Wall',
|
||||
'Lung',
|
||||
'Lymph Node',
|
||||
'Liver',
|
||||
'Mediastinum/Hilum',
|
||||
'Pelvis',
|
||||
'Peritoneum/Omentum',
|
||||
'Retroperitoneum'
|
||||
];
|
||||
|
||||
instance.commonItems = [];
|
||||
_.each(commonItems, item => {
|
||||
instance.commonItems.push({
|
||||
label: item,
|
||||
value: item
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Template.measureFlow.onRendered(() => {
|
||||
@ -116,6 +129,7 @@ Template.measureFlow.events({
|
||||
const data = {
|
||||
key: 'label',
|
||||
items: instance.items,
|
||||
commonItems: instance.commonItems,
|
||||
label: 'Assign label',
|
||||
searchPlaceholder: 'Search labels',
|
||||
storageKey: 'measureLabelCommon',
|
||||
|
||||
@ -45,8 +45,8 @@
|
||||
</div>
|
||||
{{/let}}
|
||||
</div>
|
||||
{{#if (and (not this.root) this.storageKey)}}
|
||||
{{>selectTreeCommon (clone this component=this.component)}}
|
||||
{{#if (and (not this.root) (or this.storageKey this.commonItems))}}
|
||||
{{>selectTreeCommon (clone this component=this.component treeInstance=instance)}}
|
||||
{{/if}}
|
||||
{{/group}}
|
||||
</template>
|
||||
|
||||
@ -250,27 +250,6 @@ Template.selectTree.events({
|
||||
currentInstance = currentInstance.component.parent.templateInstance;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
'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');
|
||||
|
||||
// Check if the input is not rendered
|
||||
if (!$(inputSelector).length) {
|
||||
// Change the search terms with the clicked label string
|
||||
|
||||
instance.$('.tree-search input').val($target.text()).trigger('input');
|
||||
// Wait for options rerendering
|
||||
|
||||
Tracker.afterFlush(() => {
|
||||
// Wait for components initialization
|
||||
Meteor.defer(() => $(inputSelector).click());
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -2,11 +2,43 @@ 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 ordered by use history
|
||||
items() {
|
||||
const instance = Template.instance();
|
||||
|
||||
// Return the common items if given
|
||||
if (instance.data.commonItems) {
|
||||
return instance.data.commonItems;
|
||||
}
|
||||
|
||||
// Get all the tree leaves
|
||||
const leaves = instance.data.component.getLeaves();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user