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
|
// Stop here calling the action if it's a function
|
||||||
if (typeof action === 'function') {
|
if (typeof action === 'function') {
|
||||||
component.actionResult = action.call(this, params);
|
component.actionResult = action.call(event.currentTarget, params);
|
||||||
return component.actionResult;
|
return component.actionResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ OHIF.mixins.action = new OHIF.Mixin({
|
|||||||
if (!api || !action || typeof api[action] !== 'function') return;
|
if (!api || !action || typeof api[action] !== 'function') return;
|
||||||
|
|
||||||
// Call the defined action function
|
// 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
|
// Prepend a spinner into the action element content if it's a promise
|
||||||
if (component.actionResult instanceof Promise) {
|
if (component.actionResult instanceof Promise) {
|
||||||
|
|||||||
@ -10,26 +10,28 @@
|
|||||||
{{>UI.contentBlock}}
|
{{>UI.contentBlock}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#each item in this.items}}
|
{{#each item in this.items}}
|
||||||
{{#if item.separatorBefore}}
|
{{#if isVisible item}}
|
||||||
<li role="separator" class="divider"></li>
|
{{#if item.separatorBefore}}
|
||||||
{{/if}}
|
<li role="separator" class="divider"></li>
|
||||||
<li class="{{#if item.disabled}}disabled{{/if}} {{#if item.items}}dropdown-submenu{{/if}}">
|
{{/if}}
|
||||||
{{#link item}}
|
<li class="{{#if item.disabled}}disabled{{/if}} {{#if item.items}}dropdown-submenu{{/if}}">
|
||||||
{{#if item.icon}}
|
{{#link item}}
|
||||||
<i class="{{item.icon}} {{item.iconClasses}}"></i>
|
{{#if item.icon}}
|
||||||
{{/if}}
|
<i class="{{item.icon}} {{item.iconClasses}}"></i>
|
||||||
{{#if item.iconSvgUse}}
|
{{/if}}
|
||||||
<svg class="{{item.iconClasses}}">
|
{{#if item.iconSvgUse}}
|
||||||
<use xlink:href={{absoluteUrl item.iconSvgUse}}></use>
|
<svg class="{{item.iconClasses}}">
|
||||||
</svg>
|
<use xlink:href={{absoluteUrl item.iconSvgUse}}></use>
|
||||||
{{/if}}
|
</svg>
|
||||||
{{#if item.text}}
|
{{/if}}
|
||||||
<span>{{item.text}}</span>
|
{{#if item.text}}
|
||||||
{{/if}}
|
<span>{{item.text}}</span>
|
||||||
{{/link}}
|
{{/if}}
|
||||||
</li>
|
{{/link}}
|
||||||
{{#if item.separatorAfter}}
|
</li>
|
||||||
<li role="separator" class="divider"></li>
|
{{#if item.separatorAfter}}
|
||||||
|
<li role="separator" class="divider"></li>
|
||||||
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/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 './dialog/unsavedChangesDialog.js';
|
||||||
|
|
||||||
import './dropdown/form.html';
|
import './dropdown/form.html';
|
||||||
|
import './dropdown/form.js';
|
||||||
|
|
||||||
import './form/button.html';
|
import './form/button.html';
|
||||||
import './form/form.html';
|
import './form/form.html';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user