Implementing disabled handling for commands
This commit is contained in:
1 parent
1a0729336b
commit
8aac5dc47d
13 files changed
+85
-117
No files matched your search
-16
@@ -1,16 +0,0 @@
|
||||
<template name="displaySetNavigation">
|
||||
<div id="{{this.id}}"
|
||||
class="toolbarSectionButton rp-x-1 {{this.classes}} {{#if isNext}}js-next{{else}}js-prev{{/if}} {{#if (disableButton isNext)}}disabled{{/if}}"
|
||||
title="{{this.title}}">
|
||||
<div class="svgContainer">
|
||||
{{#if isNext}}
|
||||
<i class="fa fa-toggle-down fa-fw"></i>
|
||||
{{else}}
|
||||
<i class="fa fa-toggle-up fa-fw"></i>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="buttonLabel">
|
||||
{{#if isNext}}Next{{else}}Previous{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
import { Template } from 'meteor/templating';
|
||||
|
||||
Template.displaySetNavigation.events({
|
||||
'click .js-next'(event, instance) {
|
||||
if ($(event.currentTarget).hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
OHIF.viewerbase.layoutManager.moveDisplaySets(true);
|
||||
},
|
||||
|
||||
'click .js-prev'(event, instance) {
|
||||
if ($(event.currentTarget).hasClass('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
OHIF.viewerbase.layoutManager.moveDisplaySets(false);
|
||||
}
|
||||
});
|
||||
|
||||
Template.displaySetNavigation.helpers({
|
||||
disableButton(isNext) {
|
||||
Session.get('LayoutManagerUpdated');
|
||||
|
||||
if (!OHIF.viewerbase.layoutManager) {
|
||||
return;
|
||||
}
|
||||
|
||||
return !OHIF.viewerbase.layoutManager.canMoveDisplaySets(isNext);
|
||||
}
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
<template name="playClipButton">
|
||||
<div id="{{this.id}}"
|
||||
class="toolbarSectionButton rp-x-1 {{this.classes}} {{activeClass}} {{#if isPlaying}}active{{/if}} {{#if (disableButton)}}disabled{{/if}}"
|
||||
title="{{this.title}}">
|
||||
<div class="svgContainer">
|
||||
{{#if isPlaying}}
|
||||
<i class="fa fa-stop fa-fw"></i>
|
||||
{{else}}
|
||||
<i class="fa fa-play fa-fw"></i>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="buttonLabel">
|
||||
{{#if isPlaying}}Stop{{else}}Play{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Template } from 'meteor/templating';
|
||||
import { viewportUtils } from '../../../lib/viewportUtils';
|
||||
|
||||
Template.playClipButton.helpers({
|
||||
isPlaying: function() {
|
||||
return viewportUtils.isPlaying();
|
||||
},
|
||||
disableButton() {
|
||||
return viewportUtils.hasMultipleFrames();
|
||||
}
|
||||
});
|
||||
+9
-3
@@ -79,18 +79,24 @@ Template.toolbarSectionButton.helpers({
|
||||
svgLink() {
|
||||
const instance = Template.instance();
|
||||
const activeToolId = Session.get('ToolManagerActiveTool');
|
||||
return instance.getActiveToolSubProperty('svgLink', activeToolId);
|
||||
const svgLink = instance.getActiveToolSubProperty('svgLink', activeToolId);
|
||||
return _.isFunction(svgLink) ? svgLink() : svgLink;
|
||||
},
|
||||
|
||||
iconClasses() {
|
||||
const instance = Template.instance();
|
||||
const activeToolId = Session.get('ToolManagerActiveTool');
|
||||
return instance.getActiveToolSubProperty('iconClasses', activeToolId);
|
||||
const iconClasses = instance.getActiveToolSubProperty('iconClasses', activeToolId);
|
||||
return _.isFunction(iconClasses) ? iconClasses() : iconClasses;
|
||||
},
|
||||
|
||||
disableButton() {
|
||||
Session.get('activeViewport');
|
||||
Session.get('LayoutManagerUpdated');
|
||||
const instance = Template.instance();
|
||||
return instance.data.disableFunction && instance.data.disableFunction();
|
||||
const isCommandDisabled = OHIF.commands.isDisabled(instance.data.id);
|
||||
const isFunctionDisabled = instance.data.disableFunction && instance.data.disableFunction();
|
||||
return isCommandDisabled || isFunctionDisabled;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user