Merge branch 'ja-track-changes' of github.com:sharelatex/web-sharelatex into ja-track-changes

This commit is contained in:
James Allen 2017-01-17 16:55:25 +01:00
commit 318313d66c
2 changed files with 17 additions and 2 deletions

View file

@ -83,6 +83,7 @@ define [
ide.toggleReviewPanel = $scope.toggleReviewPanel = () ->
$scope.ui.reviewPanelOpen = !$scope.ui.reviewPanelOpen
event_tracking.sendMB "rp-toggle-panel", { value : $scope.ui.reviewPanelOpen }
$scope.$watch "ui.reviewPanelOpen", (value) ->
if value?

View file

@ -4,7 +4,7 @@ define [
"ide/colors/ColorManager"
"ide/review-panel/RangesTracker"
], (App, EventEmitter, ColorManager, RangesTracker) ->
App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http) ->
App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http, event_tracking) ->
$reviewPanelEl = $element.find "#review-panel"
$scope.SubViews =
@ -273,9 +273,11 @@ define [
$scope.acceptChange = (entry_id) ->
$http.post "/project/#{$scope.project_id}/doc/#{$scope.editor.open_doc_id}/changes/#{entry_id}/accept", {_csrf: window.csrfToken}
$scope.$broadcast "change:accept", entry_id
event_tracking.sendMB "rp-change-accepted", { view: if $scope.ui.reviewPanelOpen then $scope.reviewPanel.subView else 'mini' }
$scope.rejectChange = (entry_id) ->
$scope.$broadcast "change:reject", entry_id
event_tracking.sendMB "rp-change-rejected", { view: if $scope.ui.reviewPanelOpen then $scope.reviewPanel.subView else 'mini' }
$scope.startNewComment = () ->
$scope.$broadcast "comment:select_line"
@ -292,7 +294,8 @@ define [
ide.showGenericMessageModal("Error submitting comment", "Sorry, there was a problem submitting your comment")
$timeout () ->
$scope.$broadcast "review-panel:layout"
event_tracking.sendMB "rp-new-comment", { size: content.length }
$scope.cancelNewComment = (entry) ->
$timeout () ->
$scope.$broadcast "review-panel:layout"
@ -308,6 +311,11 @@ define [
$http.post("/project/#{$scope.project_id}/thread/#{thread_id}/messages", {content, _csrf: window.csrfToken})
.error (error) ->
ide.showGenericMessageModal("Error submitting comment", "Sorry, there was a problem submitting your comment")
trackingMetadata =
view: if $scope.ui.reviewPanelOpen then $scope.reviewPanel.subView else 'mini'
size: entry.replyContent.length
thread: thread_id
thread = getThread(thread_id)
thread.submitting = true
@ -315,6 +323,7 @@ define [
entry.replying = false
$timeout () ->
$scope.$broadcast "review-panel:layout"
event_tracking.sendMB "rp-comment-reply", trackingMetadata
$scope.cancelReply = (entry) ->
entry.replying = false
@ -325,10 +334,12 @@ define [
entry.focused = false
$http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/resolve", {_csrf: window.csrfToken}
_onCommentResolved(entry.thread_id, ide.$scope.user)
event_tracking.sendMB "rp-comment-resolve", { view: if $scope.ui.reviewPanelOpen then $scope.reviewPanel.subView else 'mini' }
$scope.unresolveComment = (thread_id) ->
_onCommentReopened(thread_id)
$http.post "/project/#{$scope.project_id}/thread/#{thread_id}/reopen", {_csrf: window.csrfToken}
event_tracking.sendMB "rp-comment-reopen"
_onCommentResolved = (thread_id, user) ->
thread = $scope.reviewPanel.commentThreads[thread_id]
@ -355,9 +366,11 @@ define [
$scope.deleteComment = (entry_id, thread_id) ->
_onCommentDeleted(thread_id)
$scope.$broadcast "comment:remove", entry_id
event_tracking.sendMB "rp-comment-delete"
$scope.setSubView = (subView) ->
$scope.reviewPanel.subView = subView
event_tracking.sendMB "rp-subview-change", { subView }
$scope.gotoEntry = (doc_id, entry) ->
ide.editorManager.openDocId(doc_id, { gotoOffset: entry.offset })
@ -365,6 +378,7 @@ define [
$scope.toggleTrackChanges = (value) ->
$scope.editor.wantTrackChanges = value
$http.post "/project/#{$scope.project_id}/track_changes", {_csrf: window.csrfToken, on: value}
event_tracking.sendMB "rp-trackchanges-toggle", { value }
ide.socket.on "toggle-track-changes", (value) ->
$scope.$apply () ->