Allowing visible attribute on dropdown items
This commit is contained in:
parent
4fd18c61aa
commit
b7d1e91848
@ -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) {
|
||||
|
||||
@ -10,26 +10,28 @@
|
||||
{{>UI.contentBlock}}
|
||||
{{else}}
|
||||
{{#each item in this.items}}
|
||||
{{#if item.separatorBefore}}
|
||||
<li role="separator" class="divider"></li>
|
||||
{{/if}}
|
||||
<li class="{{#if item.disabled}}disabled{{/if}} {{#if item.items}}dropdown-submenu{{/if}}">
|
||||
{{#link item}}
|
||||
{{#if item.icon}}
|
||||
<i class="{{item.icon}} {{item.iconClasses}}"></i>
|
||||
{{/if}}
|
||||
{{#if item.iconSvgUse}}
|
||||
<svg class="{{item.iconClasses}}">
|
||||
<use xlink:href={{absoluteUrl item.iconSvgUse}}></use>
|
||||
</svg>
|
||||
{{/if}}
|
||||
{{#if item.text}}
|
||||
<span>{{item.text}}</span>
|
||||
{{/if}}
|
||||
{{/link}}
|
||||
</li>
|
||||
{{#if item.separatorAfter}}
|
||||
<li role="separator" class="divider"></li>
|
||||
{{#if isVisible item}}
|
||||
{{#if item.separatorBefore}}
|
||||
<li role="separator" class="divider"></li>
|
||||
{{/if}}
|
||||
<li class="{{#if item.disabled}}disabled{{/if}} {{#if item.items}}dropdown-submenu{{/if}}">
|
||||
{{#link item}}
|
||||
{{#if item.icon}}
|
||||
<i class="{{item.icon}} {{item.iconClasses}}"></i>
|
||||
{{/if}}
|
||||
{{#if item.iconSvgUse}}
|
||||
<svg class="{{item.iconClasses}}">
|
||||
<use xlink:href={{absoluteUrl item.iconSvgUse}}></use>
|
||||
</svg>
|
||||
{{/if}}
|
||||
{{#if item.text}}
|
||||
<span>{{item.text}}</span>
|
||||
{{/if}}
|
||||
{{/link}}
|
||||
</li>
|
||||
{{#if item.separatorAfter}}
|
||||
<li role="separator" class="divider"></li>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
});
|
||||
@ -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';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user