From 7bf55823b254b6f5388f21a3e5bda0d79aadbcca Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 15 Nov 2016 15:04:29 +0000 Subject: [PATCH] Hide review panel when there are no entries. --- .../web/app/views/project/editor/editor.jade | 2 +- .../controllers/ReviewPanelController.coffee | 6 +++++- .../web/public/stylesheets/app/editor.less | 1 - .../stylesheets/app/editor/review-panel.less | 18 ++++++++++++++++++ 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/services/web/app/views/project/editor/editor.jade b/services/web/app/views/project/editor/editor.jade index 536b0371e4..df1b8def14 100644 --- a/services/web/app/views/project/editor/editor.jade +++ b/services/web/app/views/project/editor/editor.jade @@ -9,7 +9,7 @@ div.full-size( minimum-restore-size-east="300" allow-overflow-on="'center'" ) - .ui-layout-center(ng-controller="ReviewPanelController", ng-class="{'has-review-panel': ui.reviewPanelOpen}") + .ui-layout-center(ng-controller="ReviewPanelController", ng-class="{'has-review-panel': ui.reviewPanelOpen, 'has-entries': reviewPanel.hasEntries }") .loading-panel(ng-show="!editor.sharejs_doc || editor.opening") span(ng-show="editor.open_doc_id") i.fa.fa-spin.fa-refresh diff --git a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee index f9ec800121..b0e934f501 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -7,7 +7,8 @@ define [ $scope.reviewPanel = entries: {} trackNewChanges: false - + hasEntries: false + $scope.commentState = adding: false content: "" @@ -51,6 +52,9 @@ define [ scroller.off "scroll" $scope.onScroll = null + $scope.$watch (() -> Object.keys($scope.reviewPanel.entries).length), (nEntries) -> + $scope.reviewPanel.hasEntries = nEntries > 0 + # If we listen for scroll events in the review panel natively, then with a Mac trackpad # the scroll is very smooth (natively done I'd guess), but we don't get polled regularly # enough to keep Ace in step, and it noticeably lags. If instead, we borrow the manual diff --git a/services/web/public/stylesheets/app/editor.less b/services/web/public/stylesheets/app/editor.less index fd81a94952..d702106ddd 100644 --- a/services/web/public/stylesheets/app/editor.less +++ b/services/web/public/stylesheets/app/editor.less @@ -43,7 +43,6 @@ #editor { .full-size; - right: @review-off-width; } .loading-screen { diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index f965786cd4..b184548f9b 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -60,6 +60,7 @@ } #review-panel { + display: none; position: absolute; width: @review-off-width; top: 0px; @@ -366,6 +367,22 @@ } } +.has-entries { + #editor { + right: @review-off-width; + .ace-editor-body { + overflow: visible; + .ace_scrollbar-v { + right: -@review-off-width; + } + } + } + + #review-panel { + display: block; + } +} + .has-review-panel { #editor { right: @review-panel-width; @@ -384,6 +401,7 @@ } #review-panel { + display: block; width: @review-panel-width; overflow: hidden; }