From 254e4953cb9d5fdbb1f2b10539a39d237620af38 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 23 Mar 2017 12:26:21 +0000 Subject: [PATCH 1/4] Wire-up AB test for adding comments. --- services/web/public/coffee/ide.coffee | 6 ++++++ .../review-panel/controllers/ReviewPanelController.coffee | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index 9fbbfe9937..2abb5a19b5 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -81,6 +81,12 @@ define [ if $scope.user.signUpDate >= '2016-10-27' $scope.shouldABTestPlans = true + $scope.shouldABAddCommentBtn = false + if $scope.user.signUpDate >= '2016-03-22' + $scope.shouldABAddCommentBtn = true + sixpack.participate "add-comment-btn", [ "default", "editor-corner" ], (variation) -> + $scope.variationABAddCommentBtn = variation + $scope.settings = window.userSettings $scope.anonymous = window.anonymous 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 406d2a9c5b..46e7617a9e 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -29,8 +29,13 @@ define [ loadingThreads: false newAddCommentUI: false # Test new UI for adding comments; remove afterwards. - if window.location.search.match /new-comments=true/ + if $scope.shouldABAddCommentBtn and $scope.variationABAddCommentBtn? == "editor-corner" $scope.reviewPanel.newAddCommentUI = true + console.log "editor corner" + else + console.log "default" + + console.log $scope.shouldABAddCommentBtn window.addEventListener "beforeunload", () -> collapsedStates = {} From c72ee95177e048275ac837d2ee1d9442a68612c2 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Thu, 23 Mar 2017 15:00:43 +0000 Subject: [PATCH 2/4] Refactor AB test participation code; add conversion code. --- services/web/public/coffee/ide.coffee | 6 ------ .../controllers/ReviewPanelController.coffee | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index 2abb5a19b5..9fbbfe9937 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -81,12 +81,6 @@ define [ if $scope.user.signUpDate >= '2016-10-27' $scope.shouldABTestPlans = true - $scope.shouldABAddCommentBtn = false - if $scope.user.signUpDate >= '2016-03-22' - $scope.shouldABAddCommentBtn = true - sixpack.participate "add-comment-btn", [ "default", "editor-corner" ], (variation) -> - $scope.variationABAddCommentBtn = variation - $scope.settings = window.userSettings $scope.anonymous = window.anonymous 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 46e7617a9e..4ce7741dcc 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -4,7 +4,7 @@ define [ "ide/colors/ColorManager" "ide/review-panel/RangesTracker" ], (App, EventEmitter, ColorManager, RangesTracker) -> - App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http, $modal, event_tracking, localStorage) -> + App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http, $modal, event_tracking, sixpack, localStorage) -> $reviewPanelEl = $element.find "#review-panel" $scope.SubViews = @@ -29,13 +29,12 @@ define [ loadingThreads: false newAddCommentUI: false # Test new UI for adding comments; remove afterwards. - if $scope.shouldABAddCommentBtn and $scope.variationABAddCommentBtn? == "editor-corner" - $scope.reviewPanel.newAddCommentUI = true - console.log "editor corner" - else - console.log "default" - - console.log $scope.shouldABAddCommentBtn + $scope.shouldABAddCommentBtn = false + if $scope.user.signUpDate >= '2016-03-22' + sixpack.participate "add-comment-btn", [ "default", "editor-corner" ], (variation) -> + $scope.shouldABAddCommentBtn = true + $scope.variationABAddCommentBtn = variation + $scope.reviewPanel.newAddCommentUI = (variation == "editor-corner") window.addEventListener "beforeunload", () -> collapsedStates = {} @@ -344,7 +343,9 @@ define [ $scope.$broadcast "comment:select_line" $timeout () -> $scope.$broadcast "review-panel:layout" - + if $scope.shouldABAddCommentBtn and !$scope.ui.reviewPanelOpen + sixpack.convert "add-comment-btn" + $scope.submitNewComment = (content) -> return if !content? or content == "" doc_id = $scope.editor.open_doc_id From 78e8a8319d25ebb1446469a0f4026c8be2d638ee Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Fri, 24 Mar 2017 14:04:37 +0000 Subject: [PATCH 3/4] Put review panel widgets container inside the review panel element; rearrange visibility logic. --- .../app/views/project/editor/review-panel.pug | 28 +++++++++---------- .../stylesheets/app/editor/review-panel.less | 16 +++++++---- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/services/web/app/views/project/editor/review-panel.pug b/services/web/app/views/project/editor/review-panel.pug index 89b0e05305..da14b69a99 100644 --- a/services/web/app/views/project/editor/review-panel.pug +++ b/services/web/app/views/project/editor/review-panel.pug @@ -1,18 +1,18 @@ -.rp-in-editor-widgets - a.rp-track-changes-indicator( - href - ng-if="editor.wantTrackChanges" - ng-click="toggleReviewPanel();" - ng-class="{ 'rp-track-changes-indicator-on-dark' : darkTheme }" - ) !{translate("track_changes_is_on")} - a.rp-add-comment-btn( - href - ng-if="reviewPanel.newAddCommentUI && reviewPanel.entries[editor.open_doc_id]['add-comment'] != null" - ng-click="addNewComment();" - ) - i.fa.fa-comment - |  #{translate("add_comment")} #review-panel + .rp-in-editor-widgets + a.rp-track-changes-indicator( + href + ng-if="editor.wantTrackChanges" + ng-click="toggleReviewPanel();" + ng-class="{ 'rp-track-changes-indicator-on-dark' : darkTheme }" + ) !{translate("track_changes_is_on")} + a.rp-add-comment-btn( + href + ng-if="reviewPanel.newAddCommentUI && reviewPanel.entries[editor.open_doc_id]['add-comment'] != null" + ng-click="addNewComment();" + ) + i.fa.fa-comment + |  #{translate("add_comment")} .review-panel-toolbar resolved-comments-dropdown( class="rp-flex-block" diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index c97c3bf9a3..3030e7dbb9 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -90,7 +90,7 @@ } #review-panel { - display: none; + display: block; .rp-size-expanded & { display: flex; flex-direction: column; @@ -98,7 +98,6 @@ overflow: visible; } .rp-size-mini & { - display: block; width: @review-off-width; z-index: 6; } @@ -152,7 +151,13 @@ } .rp-entry-list { + display: none; width: 100%; + + .rp-size-expanded &, + .rp-size-mini & { + display: block; + } .rp-state-current-file & { position: absolute; @@ -620,11 +625,12 @@ } .rp-nav { - display: flex; + display: none; flex-shrink: 0; - .rp-size-mini & { - display: none; + .rp-size-expanded & { + display: flex; } + .rp-state-current-file & { position: absolute; bottom: 0; From 93934b9c8f091ea13485c994c76a96e7d2e20f55 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Mon, 27 Mar 2017 09:32:02 +0100 Subject: [PATCH 4/4] Use deploy date. --- .../ide/review-panel/controllers/ReviewPanelController.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4ce7741dcc..d4c40084bd 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -30,7 +30,7 @@ define [ newAddCommentUI: false # Test new UI for adding comments; remove afterwards. $scope.shouldABAddCommentBtn = false - if $scope.user.signUpDate >= '2016-03-22' + if $scope.user.signUpDate >= '2017-03-27' sixpack.participate "add-comment-btn", [ "default", "editor-corner" ], (variation) -> $scope.shouldABAddCommentBtn = true $scope.variationABAddCommentBtn = variation