LT-318 Disable Case Progress, Trial, HUD and Measurements panels if the study is not associated

This commit is contained in:
Evren Ozkan 2016-11-10 11:23:51 -05:00 committed by Erik Ziegler
parent 24d3c1bd8a
commit 4dd9ee3f37
7 changed files with 37 additions and 8 deletions

View File

@ -14,10 +14,10 @@
{{>studySeriesQuickSwitch (clone this side="middle" viewportIndex=0)}}
{{/if}}
<div class="toolbarSectionEntry pull-right rm-l-1 p-x-1">
<div id="toolbarSectionEntry" class="toolbarSectionEntry pull-right rm-l-1 p-x-1">
{{>caseProgress}}
</div>
<div class="pull-right m-t-1 rm-x-1">
<div id="toggleMeasurements" class="pull-right m-t-1 rm-x-1">
{{>roundedButtonGroup rightSidebarToggleButtonData}}
</div>
<div id="toggleHUD" class="toolbarSectionButton pull-right rp-x-1 m-t-1 rm-r-3 {{#if session 'measurementTableHudOpen'}}active{{/if}}">

View File

@ -145,7 +145,7 @@ Template.toolbarSection.helpers({
Template.toolbarSection.events({
'click #toggleHUD'(event) {
const $this = $(event.currentTarget).find('#toggleHUD');
const $this = $(event.currentTarget);
// Stop here if the tool is disabled
if ($this.hasClass('disabled')) {
@ -156,7 +156,7 @@ Template.toolbarSection.events({
Session.set('measurementTableHudOpen', !state);
},
'click #toggleTrial'(event) {
const $this = $(event.currentTarget).find('#toggleHUD');
const $this = $(event.currentTarget);
// Stop here if the tool is disabled
if ($this.hasClass('disabled')) {
@ -172,14 +172,21 @@ Template.toolbarSection.onRendered(function() {
const states = toolManager.getToolDefaultStates();
const disabledToolButtons = states.disabledToolButtons;
const allToolbarButtons = $('.toolbarSection').find('.toolbarSectionButton');
// Additional toolbar buttons whose classes are not toolbarSectionButton
allToolbarButtons.push($('#toolbarSectionEntry')[0]);
allToolbarButtons.push($('#toggleMeasurements')[0]);
if (disabledToolButtons && disabledToolButtons.length > 0) {
for (var i = 0; i < allToolbarButtons.length; i++) {
const toolbarButton = allToolbarButtons[i];
$(toolbarButton).removeClass('disabled');
const index = disabledToolButtons.indexOf($(toolbarButton).attr('id'));
if (index !== -1) {
$(toolbarButton).addClass('disabled');
$(toolbarButton).find('*').addClass('disabled');
} else {
$(toolbarButton).removeClass('disabled');
$(toolbarButton).find('*').removeClass('disabled');
}
}
}

View File

@ -27,6 +27,12 @@ Template.roundedButtonGroup.events({
'click [data-value]'(event, instance) {
event.preventDefault();
const $target = $(event.currentTarget);
// Stop here if the tool is disabled
if ($target.hasClass('disabled')) {
return;
}
const nullValue = $target.hasClass('active') && instance.data.toggleable;
const value = nullValue ? null : $target.attr('data-value');
instance.setValue(value);

View File

@ -12,6 +12,10 @@ $height = 25px
text-decoration: none
text-align: center
&.disabled
opacity: 0.5
cursor: not-allowed
.roundedButton
align-items: center
theme('background-color', '$uiGrayDark')

View File

@ -48,7 +48,8 @@ OHIF.lesiontracker.toggleLesionTrackerToolsButtons = (isEnabled) => {
if (isEnabled) {
toolStates.disabledToolButtons = [];
} else {
toolStates.disabledToolButtons = [ 'bidirectional', 'nonTarget', 'crTool', 'unTool', 'exTool', 'toggleHUD', 'toggleTrial', 'toolbarSectionEntry' ];
toolStates.disabledToolButtons = [ 'bidirectional', 'nonTarget', 'crTool', 'unTool', 'exTool',
'toggleHUD', 'toggleTrial', 'toolbarSectionEntry', 'toggleMeasurements' ];
}
// Reload the updated previous or default states

View File

@ -122,7 +122,14 @@ Template.caseProgress.helpers({
});
Template.caseProgress.events({
'click .js-finish-case'() {
'click .js-finish-case'(event) {
const $this = $(event.currentTarget);
// Stop here if the tool is disabled
if ($this.hasClass('disabled')) {
return;
}
const instance = Template.instance();
switchToTab('studylistTab');
instance.data.measurementApi.storeMeasurements();

View File

@ -30,3 +30,7 @@
margin-top: 6px
text-align: center
width: 126px
&.disabled
opacity: 0.5
cursor: not-allowed