Adapting header to the new structure
This commit is contained in:
1 parent
2d52c9ef0a
commit
e83b5348ff
34 files changed
+395
-154
No files matched your search
@@ -3,27 +3,31 @@ import { Blaze } from 'meteor/blaze';
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.ui.showDropdown = (items=[], options={}) => {
|
||||
let promiseResolve;
|
||||
let promiseReject;
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
promiseResolve = resolve;
|
||||
promiseReject = reject;
|
||||
});
|
||||
|
||||
// Prepare the method to destroy the view
|
||||
let view;
|
||||
const destroyView = () => Blaze.remove(view);
|
||||
|
||||
// Create the data object that the dropdown will receive
|
||||
const templateData = {
|
||||
items,
|
||||
options,
|
||||
destroyView
|
||||
destroyView,
|
||||
promise,
|
||||
promiseResolve,
|
||||
promiseReject
|
||||
};
|
||||
|
||||
// Render the dialog with the given template and data
|
||||
const parentElement = options.parentElement || document.body;
|
||||
view = Blaze.renderWithData(Template.dropdownForm, templateData, parentElement);
|
||||
};
|
||||
|
||||
Meteor.startup(() => {
|
||||
OHIF.ui.showDropdown([{
|
||||
text: 'test 1',
|
||||
action: () => console.warn('test1Clicked'),
|
||||
separatorAfter: true
|
||||
}, {
|
||||
text: 'test 2',
|
||||
action: () => console.warn('test2Clicked')
|
||||
}]);
|
||||
});
|
||||
// Return the promise to allow callbacks stacking from outside
|
||||
return promise;
|
||||
};
|
||||
Reference in new issue
Block a user