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 = [
|
const items = [
|
||||||
'Adrenal',
|
'Adrenal',
|
||||||
'Bladder',
|
|
||||||
'Bone',
|
|
||||||
'Brain',
|
|
||||||
'Breast',
|
|
||||||
'Colon',
|
|
||||||
'Esophagus',
|
|
||||||
'Extremities',
|
|
||||||
'Gallbladder',
|
|
||||||
'Kidney',
|
|
||||||
'Liver',
|
|
||||||
'Lung',
|
|
||||||
'Lymph Node',
|
|
||||||
'Muscle',
|
'Muscle',
|
||||||
|
'Bladder',
|
||||||
'Neck',
|
'Neck',
|
||||||
'Other: Soft Tissue',
|
'Bone',
|
||||||
|
'Other Soft Tissue',
|
||||||
|
'Brain',
|
||||||
'Ovary',
|
'Ovary',
|
||||||
|
'Breast',
|
||||||
'Pancreas',
|
'Pancreas',
|
||||||
'Pelvis',
|
'Colon',
|
||||||
'Peritoneum/Omentum',
|
|
||||||
'Prostate',
|
'Prostate',
|
||||||
'Retroperitoneum',
|
'Esophagus',
|
||||||
'Small Bowel',
|
'Small Bowel',
|
||||||
|
'Extremities',
|
||||||
'Spleen',
|
'Spleen',
|
||||||
|
'Gallbladder',
|
||||||
'Stomach',
|
'Stomach',
|
||||||
|
'Kidney',
|
||||||
'Subcutaneous'
|
'Subcutaneous'
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -90,6 +84,25 @@ Template.measureFlow.onCreated(() => {
|
|||||||
value: item
|
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(() => {
|
Template.measureFlow.onRendered(() => {
|
||||||
@ -116,6 +129,7 @@ Template.measureFlow.events({
|
|||||||
const data = {
|
const data = {
|
||||||
key: 'label',
|
key: 'label',
|
||||||
items: instance.items,
|
items: instance.items,
|
||||||
|
commonItems: instance.commonItems,
|
||||||
label: 'Assign label',
|
label: 'Assign label',
|
||||||
searchPlaceholder: 'Search labels',
|
searchPlaceholder: 'Search labels',
|
||||||
storageKey: 'measureLabelCommon',
|
storageKey: 'measureLabelCommon',
|
||||||
|
|||||||
@ -45,8 +45,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{{/let}}
|
{{/let}}
|
||||||
</div>
|
</div>
|
||||||
{{#if (and (not this.root) this.storageKey)}}
|
{{#if (and (not this.root) (or this.storageKey this.commonItems))}}
|
||||||
{{>selectTreeCommon (clone this component=this.component)}}
|
{{>selectTreeCommon (clone this component=this.component treeInstance=instance)}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/group}}
|
{{/group}}
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -250,27 +250,6 @@ Template.selectTree.events({
|
|||||||
currentInstance = currentInstance.component.parent.templateInstance;
|
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 { Template } from 'meteor/templating';
|
||||||
import { _ } from 'meteor/underscore';
|
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({
|
Template.selectTreeCommon.helpers({
|
||||||
// Get the common items ordered by use history
|
// Get the common items ordered by use history
|
||||||
items() {
|
items() {
|
||||||
const instance = Template.instance();
|
const instance = Template.instance();
|
||||||
|
|
||||||
|
// Return the common items if given
|
||||||
|
if (instance.data.commonItems) {
|
||||||
|
return instance.data.commonItems;
|
||||||
|
}
|
||||||
|
|
||||||
// Get all the tree leaves
|
// Get all the tree leaves
|
||||||
const leaves = instance.data.component.getLeaves();
|
const leaves = instance.data.component.getLeaves();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user