diff --git a/services/web/app/views/project/editor/review-panel.jade b/services/web/app/views/project/editor/review-panel.jade index 91c2b84c41..4ec1d24f6e 100644 --- a/services/web/app/views/project/editor/review-panel.jade +++ b/services/web/app/views/project/editor/review-panel.jade @@ -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, 'threadId': threadId });" + 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, threadId);" ) + .rp-loading(ng-if="!resolvedComments.length") + | No resolved threads. diff --git a/services/web/public/coffee/ide/review-panel/directives/resolvedCommentEntry.coffee b/services/web/public/coffee/ide/review-panel/directives/resolvedCommentEntry.coffee index ad6e9f2099..76da5b2913 100644 --- a/services/web/public/coffee/ide/review-panel/directives/resolvedCommentEntry.coffee +++ b/services/web/public/coffee/ide/review-panel/directives/resolvedCommentEntry.coffee @@ -5,9 +5,6 @@ define [ restrict: "E" templateUrl: "resolvedCommentEntryTemplate" scope: - entryId: "=" - threadId: "=" thread: "=" - doc: "=" onUnresolve: "&" onDelete: "&" \ No newline at end of file diff --git a/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee b/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee index a440be0585..38a440dfa0 100644 --- a/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee +++ b/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee @@ -1,7 +1,7 @@ define [ "base" ], (App) -> - App.directive "resolvedCommentsDropdown", () -> + App.directive "resolvedCommentsDropdown", (_) -> restrict: "E" templateUrl: "resolvedCommentsDropdownTemplate" scope: @@ -23,7 +23,7 @@ define [ filterResolvedComments() scope.onOpen() - scope.resolvedCommentsPerFile = {} + scope.resolvedComments = [] scope.handleUnresolve = (threadId) -> scope.onUnresolve({ threadId }) @@ -33,18 +33,28 @@ define [ 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 diff --git a/services/web/public/stylesheets/app/editor/review-panel.less b/services/web/public/stylesheets/app/editor/review-panel.less index 2d02361b54..aa14e2c2d4 100644 --- a/services/web/public/stylesheets/app/editor/review-panel.less +++ b/services/web/public/stylesheets/app/editor/review-panel.less @@ -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);