PWV-1: Refactoring ohif:studylist package
This commit is contained in:
1 parent
984ef94403
commit
4d79bf84a8
79 files changed
+450
-551
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { Blaze } from 'meteor/blaze';
|
||||
import { _ } from 'meteor/underscore';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.ui.showFormDropdown = (templateName, dropdownData) => {
|
||||
// Check if the given template exists
|
||||
const template = Template[templateName];
|
||||
if (!template) {
|
||||
throw {
|
||||
name: 'TEMPLATE_NOT_FOUND',
|
||||
message: `Template ${templateName} not found.`
|
||||
};
|
||||
}
|
||||
|
||||
// Prepare the method to destroy the view
|
||||
let view;
|
||||
const destroyView = () => Blaze.remove(view);
|
||||
const templateData = _.extend({}, dropdownData, {
|
||||
destroyView
|
||||
});
|
||||
|
||||
// Render the dialog with the given template and data
|
||||
view = Blaze.renderWithData(template, templateData, document.body);
|
||||
|
||||
// Return the dropdown element to enable position manipulation
|
||||
const dropdown = view.firstNode();
|
||||
return dropdown;
|
||||
};
|
||||
Reference in new issue
Block a user