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

This commit is contained in:
James Allen 2017-01-10 13:44:01 +01:00
commit 85c613e161
5 changed files with 40 additions and 43 deletions

View file

@ -6,7 +6,7 @@
docs="docs"
on-open="refreshResolvedCommentsDropdown();"
on-unresolve="unresolveComment(threadId);"
on-delete="deleteComment(entryId);"
on-delete="deleteComment(entryId, threadId);"
is-loading="reviewPanel.dropdown.loading"
)
span.review-panel-toolbar-label(ng-click="editor.wantTrackChanges = true;", ng-if="editor.wantTrackChanges === false") Track Changes is
@ -180,7 +180,7 @@ script(type='text/ng-template', id='resolvedCommentEntryTemplate')
div
.rp-resolved-comment-context
| Quoted text on 
span.rp-resolved-comment-context-file {{ doc.doc.name }}
span.rp-resolved-comment-context-file {{ thread.docName }}
p.rp-resolved-comment-context-quote {{ thread.content }}
.rp-comment(
ng-repeat="comment in thread.messages track by comment.id"
@ -205,12 +205,12 @@ script(type='text/ng-template', id='resolvedCommentEntryTemplate')
.rp-entry-actions
a.rp-entry-button(
href
ng-click="onUnresolve({ 'threadId': threadId });"
ng-click="onUnresolve({ 'threadId': thread.threadId });"
)
|  Re-open
a.rp-entry-button(
href
ng-click="onDelete({ 'entryId': entryId });"
ng-click="onDelete({ 'entryId': thread.entryId, 'threadId': thread.threadId });"
)
|  Delete
@ -269,15 +269,13 @@ script(type='text/ng-template', id='resolvedCommentsDropdownTemplate')
i.fa.fa-spinner.fa-spin
div(
ng-if="!isLoading"
ng-repeat="doc in docs"
)
resolved-comment-entry(
ng-repeat="thread in resolvedCommentsPerFile[doc.doc.id]"
entry-id="thread.entryId"
thread-id="thread.threadId"
ng-repeat="thread in resolvedComments"
thread="thread"
doc="doc"
on-unresolve="handleUnresolve(threadId);"
on-delete="handleDelete(entryId);"
on-delete="handleDelete(entryId, threadId);"
)
.rp-loading(ng-if="!resolvedComments.length")
| No resolved threads.

View file

@ -69,7 +69,7 @@ define [
$scope.reviewPanelEventsBridge.on "aceScrollbarVisibilityChanged", (isVisible, scrollbarWidth) ->
scrollbar = {isVisible, scrollbarWidth}
updateScrollbar()
updateScrollbar = () ->
if scrollbar.isVisible and $scope.reviewPanel.subView == $scope.SubViews.CUR_FILE
$reviewPanelEl.css "right", "#{ scrollbar.scrollbarWidth }px"
@ -222,9 +222,6 @@ define [
$scope.$broadcast "review-panel:recalculate-screen-positions"
$scope.$broadcast "review-panel:layout"
$scope.$on "comment:removed", (comment) ->
console.log comment
$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
@ -274,7 +271,6 @@ define [
$scope.$broadcast "review-panel:layout"
$scope.resolveComment = (entry, entry_id) ->
entry.showWhenResolved = false
entry.focused = false
$http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/resolve", {_csrf: window.csrfToken}
_onCommentResolved(entry.thread_id, ide.$scope.user)
@ -298,20 +294,15 @@ define [
delete thread.resolved_at
delete resolvedThreadIds[thread_id]
$scope.$broadcast "comment:unresolve_thread", thread_id
_onCommentDeleted = (thread_id) ->
delete $scope.reviewPanel.commentThreads[thread_id]
$scope.deleteComment = (entry_id) ->
$scope.deleteComment = (entry_id, thread_id) ->
console.log thread_id
_onCommentDeleted(thread_id)
$scope.$broadcast "comment:remove", entry_id
$scope.showThread = (entry) ->
entry.showWhenResolved = true
$timeout () ->
$scope.$broadcast "review-panel:layout"
$scope.hideThread = (entry) ->
entry.showWhenResolved = false
$timeout () ->
$scope.$broadcast "review-panel:layout"
$scope.setSubView = (subView) ->
$scope.reviewPanel.subView = subView

View file

@ -5,9 +5,6 @@ define [
restrict: "E"
templateUrl: "resolvedCommentEntryTemplate"
scope:
entryId: "="
threadId: "="
thread: "="
doc: "="
onUnresolve: "&"
onDelete: "&"

View file

@ -1,7 +1,7 @@
define [
"base"
], (App) ->
App.directive "resolvedCommentsDropdown", () ->
App.directive "resolvedCommentsDropdown", (_) ->
restrict: "E"
templateUrl: "resolvedCommentsDropdownTemplate"
scope:
@ -23,28 +23,38 @@ define [
filterResolvedComments()
scope.onOpen()
scope.resolvedCommentsPerFile = {}
scope.resolvedComments = []
scope.handleUnresolve = (threadId) ->
scope.onUnresolve({ threadId })
filterResolvedComments()
scope.handleDelete = (entryId) ->
scope.onDelete({ entryId })
scope.handleDelete = (entryId, threadId) ->
scope.onDelete({ entryId, threadId })
filterResolvedComments()
getDocNameById = (docId) ->
doc = _.find(scope.docs, (doc) -> doc.doc.id = docId)
if doc?
return doc.path
else
return null
filterResolvedComments = () ->
scope.resolvedCommentsPerFile = {}
scope.resolvedComments = []
for fileId, fileEntries of scope.entries
scope.resolvedCommentsPerFile[fileId] = {}
for entryId, entry of fileEntries
for docId, docEntries of scope.entries
for entryId, entry of docEntries
if entry.type == "comment" and scope.threads[entry.thread_id]?.resolved?
scope.resolvedCommentsPerFile[fileId][entryId] = angular.copy scope.threads[entry.thread_id]
scope.resolvedCommentsPerFile[fileId][entryId].content = entry.content
scope.resolvedCommentsPerFile[fileId][entryId].threadId = entry.thread_id
scope.resolvedCommentsPerFile[fileId][entryId].entryId = entryId
resolvedComment = angular.copy scope.threads[entry.thread_id]
resolvedComment.content = entry.content
resolvedComment.threadId = entry.thread_id
resolvedComment.entryId = entryId
resolvedComment.docId = docId
resolvedComment.docName = getDocNameById(docId)
scope.resolvedComments.push(resolvedComment)
scope.$watchCollection "entries", filterResolvedComments
scope.$watchCollection "threads", filterResolvedComments

View file

@ -498,7 +498,8 @@
text-align: center;
}
.rp-loading {
.rp-loading,
.rp-empty {
text-align: center;
padding: 5px;
}
@ -709,7 +710,7 @@
margin-left: 1em;
background-color: @rp-bg-blue;
text-align: left;
padding: 5px 5px 0;
padding: 5px;
border-radius: 3px;
box-shadow: 0 0 20px 10px rgba(0, 0, 0, .3);