diff --git a/Packages/ohif-core/client/components/base/mixins/action.js b/Packages/ohif-core/client/components/base/mixins/action.js index 26e139bd8..a2ac27758 100644 --- a/Packages/ohif-core/client/components/base/mixins/action.js +++ b/Packages/ohif-core/client/components/base/mixins/action.js @@ -32,7 +32,7 @@ OHIF.mixins.action = new OHIF.Mixin({ // Stop here calling the action if it's a function if (typeof action === 'function') { - component.actionResult = action.call(this, params); + component.actionResult = action.call(event.currentTarget, params); return component.actionResult; } @@ -40,7 +40,7 @@ OHIF.mixins.action = new OHIF.Mixin({ if (!api || !action || typeof api[action] !== 'function') return; // Call the defined action function - component.actionResult = api[action].call(this, params); + component.actionResult = api[action].call(event.currentTarget, params); // Prepend a spinner into the action element content if it's a promise if (component.actionResult instanceof Promise) { diff --git a/Packages/ohif-core/client/components/bootstrap/dropdown/form.html b/Packages/ohif-core/client/components/bootstrap/dropdown/form.html index ac7d668d9..1744f7e6d 100644 --- a/Packages/ohif-core/client/components/bootstrap/dropdown/form.html +++ b/Packages/ohif-core/client/components/bootstrap/dropdown/form.html @@ -10,26 +10,28 @@ {{>UI.contentBlock}} {{else}} {{#each item in this.items}} - {{#if item.separatorBefore}} - - {{/if}} -
  • - {{#link item}} - {{#if item.icon}} - - {{/if}} - {{#if item.iconSvgUse}} - - - - {{/if}} - {{#if item.text}} - {{item.text}} - {{/if}} - {{/link}} -
  • - {{#if item.separatorAfter}} - + {{#if isVisible item}} + {{#if item.separatorBefore}} + + {{/if}} +
  • + {{#link item}} + {{#if item.icon}} + + {{/if}} + {{#if item.iconSvgUse}} + + + + {{/if}} + {{#if item.text}} + {{item.text}} + {{/if}} + {{/link}} +
  • + {{#if item.separatorAfter}} + + {{/if}} {{/if}} {{/each}} {{/if}} diff --git a/Packages/ohif-core/client/components/bootstrap/dropdown/form.js b/Packages/ohif-core/client/components/bootstrap/dropdown/form.js new file mode 100644 index 000000000..5c0f6dd48 --- /dev/null +++ b/Packages/ohif-core/client/components/bootstrap/dropdown/form.js @@ -0,0 +1,14 @@ +import { Template } from 'meteor/templating'; + +Template.dropdownFormMenu.helpers({ + isVisible(item) { + let isVisible = true; + if (typeof item.visible === 'function') { + isVisible = item.visible(); + } else if (typeof item.visible !== 'undefined') { + isVisible = !!item.visible; + } + + return isVisible; + } +}); diff --git a/Packages/ohif-core/client/components/bootstrap/index.js b/Packages/ohif-core/client/components/bootstrap/index.js index a85beb554..2de8cc008 100644 --- a/Packages/ohif-core/client/components/bootstrap/index.js +++ b/Packages/ohif-core/client/components/bootstrap/index.js @@ -16,6 +16,7 @@ import './dialog/unsavedChangesDialog.html'; import './dialog/unsavedChangesDialog.js'; import './dropdown/form.html'; +import './dropdown/form.js'; import './form/button.html'; import './form/form.html';