From e6b18f6c969a533c16c35b09c12e5bb9f4c2957a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Botelho=20Almeida?= Date: Wed, 15 Nov 2017 05:17:52 -0200 Subject: [PATCH] OHIF-179: Only show left side bar when study has more than one series (#131) --- .../toolbarSection/toolbarSection.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/OHIFViewer/client/components/toolbarSection/toolbarSection.js b/OHIFViewer/client/components/toolbarSection/toolbarSection.js index ff42524e0..113d9ac2b 100644 --- a/OHIFViewer/client/components/toolbarSection/toolbarSection.js +++ b/OHIFViewer/client/components/toolbarSection/toolbarSection.js @@ -4,10 +4,26 @@ import { $ } from 'meteor/jquery'; import { OHIF } from 'meteor/ohif:core'; import 'meteor/ohif:viewerbase'; +function isThereSeries(studies) { + if (studies.length === 1) { + const study = studies[0]; + + if (study.seriesList && study.seriesList.length > 1) { + return true; + } + + if (study.displaySets && study.displaySets.length > 1) { + return true; + } + } + + return false; +} + Template.toolbarSection.onCreated(() => { const instance = Template.instance(); - if (OHIF.uiSettings.leftSidebarOpen) { + if (OHIF.uiSettings.leftSidebarOpen && isThereSeries(instance.data.studies)) { instance.data.state.set('leftSidebar', 'studies'); } });