From a3ab994ab3213b6e5c102031a785079c839a0cd3 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 11 May 2017 10:17:25 +0100 Subject: [PATCH] Use the same watcher to control miniRP visibility and trigger Ace resizing. --- services/web/app/views/project/editor/editor.pug | 2 +- services/web/public/coffee/ide.coffee | 1 + .../review-panel/controllers/ReviewPanelController.coffee | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/services/web/app/views/project/editor/editor.pug b/services/web/app/views/project/editor/editor.pug index 6c062f3cbe..e8217a9319 100644 --- a/services/web/app/views/project/editor/editor.pug +++ b/services/web/app/views/project/editor/editor.pug @@ -16,7 +16,7 @@ div.full-size( 'rp-state-current-file-expanded': (reviewPanel.subView === SubViews.CUR_FILE && ui.reviewPanelOpen),\ 'rp-state-current-file-mini': (reviewPanel.subView === SubViews.CUR_FILE && !ui.reviewPanelOpen),\ 'rp-state-overview': (reviewPanel.subView === SubViews.OVERVIEW),\ - 'rp-size-mini': (!ui.reviewPanelOpen && reviewPanel.hasEntries),\ + 'rp-size-mini': ui.miniReviewPanelVisible,\ 'rp-size-expanded': ui.reviewPanelOpen,\ 'rp-layout-left': reviewPanel.layoutToLeft,\ 'rp-loading-threads': reviewPanel.loadingThreads,\ diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index 9fbbfe9937..dabf166578 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -70,6 +70,7 @@ define [ chatOpen: false pdfLayout: 'sideBySide' reviewPanelOpen: localStorage("ui.reviewPanelOpen.#{window.project_id}") + miniReviewPanelVisible: false } $scope.user = window.user 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 bf3f96ffc3..101915a4dc 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -126,6 +126,12 @@ define [ else $reviewPanelEl.css "right", "0" + $scope.$watch "!ui.reviewPanelOpen && reviewPanel.hasEntries", (open, prevVal) -> + return if !open? + $scope.ui.miniReviewPanelVisible = open + if open != prevVal + $timeout () -> $scope.$broadcast "review-panel:toggle" + $scope.$watch "ui.reviewPanelOpen", (open) -> return if !open? if !open