From 4dd9ee3f3755d938a8746a62d4024c511ee53157 Mon Sep 17 00:00:00 2001 From: Evren Ozkan Date: Thu, 10 Nov 2016 11:23:51 -0500 Subject: [PATCH] LT-318 Disable Case Progress, Trial, HUD and Measurements panels if the study is not associated --- .../components/toolbarSection/toolbarSection.html | 4 ++-- .../components/toolbarSection/toolbarSection.js | 15 +++++++++++---- .../roundedButtonGroup/roundedButtonGroup.js | 6 ++++++ .../roundedButtonGroup/roundedButtonGroup.styl | 4 ++++ .../client/lib/toggleLesionTrackerTools.js | 3 ++- .../components/caseProgress/caseProgress.js | 9 ++++++++- .../components/caseProgress/caseProgress.styl | 4 ++++ 7 files changed, 37 insertions(+), 8 deletions(-) diff --git a/LesionTracker/client/components/toolbarSection/toolbarSection.html b/LesionTracker/client/components/toolbarSection/toolbarSection.html index bbb6dcf37..b55d02fe1 100644 --- a/LesionTracker/client/components/toolbarSection/toolbarSection.html +++ b/LesionTracker/client/components/toolbarSection/toolbarSection.html @@ -14,10 +14,10 @@ {{>studySeriesQuickSwitch (clone this side="middle" viewportIndex=0)}} {{/if}} -
+
{{>caseProgress}}
-
+
{{>roundedButtonGroup rightSidebarToggleButtonData}}
diff --git a/LesionTracker/client/components/toolbarSection/toolbarSection.js b/LesionTracker/client/components/toolbarSection/toolbarSection.js index 5b4d1bc77..57281dc1e 100644 --- a/LesionTracker/client/components/toolbarSection/toolbarSection.js +++ b/LesionTracker/client/components/toolbarSection/toolbarSection.js @@ -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'); } } } diff --git a/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.js b/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.js index 2631cf6d6..721d329af 100644 --- a/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.js +++ b/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.js @@ -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); diff --git a/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.styl b/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.styl index d55e5f3c9..793731fa5 100644 --- a/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.styl +++ b/Packages/ohif-design/components/roundedButtonGroup/roundedButtonGroup.styl @@ -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') diff --git a/Packages/ohif-lesiontracker/client/lib/toggleLesionTrackerTools.js b/Packages/ohif-lesiontracker/client/lib/toggleLesionTrackerTools.js index 7be0649cb..6dd34e112 100644 --- a/Packages/ohif-lesiontracker/client/lib/toggleLesionTrackerTools.js +++ b/Packages/ohif-lesiontracker/client/lib/toggleLesionTrackerTools.js @@ -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 diff --git a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js b/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js index 80d33527a..8cd42a652 100644 --- a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js +++ b/Packages/ohif-measurements/client/components/caseProgress/caseProgress.js @@ -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(); diff --git a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.styl b/Packages/ohif-measurements/client/components/caseProgress/caseProgress.styl index 3fe96cb04..9fc5594c4 100644 --- a/Packages/ohif-measurements/client/components/caseProgress/caseProgress.styl +++ b/Packages/ohif-measurements/client/components/caseProgress/caseProgress.styl @@ -30,3 +30,7 @@ margin-top: 6px text-align: center width: 126px + + &.disabled + opacity: 0.5 + cursor: not-allowed