Add unresolve action to the dropdown.

This commit is contained in:
Paulo Reis 2017-01-09 17:22:01 +00:00
parent 4e128b6ab7
commit 70134d44d0
4 changed files with 18 additions and 6 deletions

View file

@ -5,6 +5,7 @@
threads="reviewPanel.commentThreads"
docs="docs"
on-open="refreshResolvedCommentsDropdown();"
on-unresolve="unresolveComment(threadId);"
is-loading="reviewPanel.dropdown.loading"
)
span.review-panel-toolbar-label(ng-click="editor.wantTrackChanges = true;", ng-if="editor.wantTrackChanges === false") Track Changes is
@ -201,7 +202,10 @@ script(type='text/ng-template', id='resolvedCommentEntryTemplate')
| {{ thread.resolved_at | date : 'MMM d, y h:mm a' }}
.rp-entry-actions
a.rp-entry-button(href, ng-click="onUnresolve();")
a.rp-entry-button(
href
ng-click="onUnresolve({ 'threadId': threadId });"
)
|  Re-open
a.rp-entry-button(href, ng-click="onDelete();")
|  Delete
@ -265,7 +269,9 @@ script(type='text/ng-template', id='resolvedCommentsDropdownTemplate')
)
resolved-comment-entry(
ng-repeat="thread in resolvedCommentsPerFile[doc.doc.id]"
thread-id="thread.threadId"
thread="thread"
doc="doc"
on-unresolve="handleUnresolve(threadId);"
)

View file

@ -285,9 +285,9 @@ define [
$http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/resolve", {_csrf: window.csrfToken}
_onCommentResolved(entry.thread_id, ide.$scope.user)
$scope.unresolveComment = (entry, entry_id) ->
_onCommentReopened(entry.thread_id)
$http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/reopen", {_csrf: window.csrfToken}
$scope.unresolveComment = (thread_id) ->
_onCommentReopened(thread_id)
$http.post "/project/#{$scope.project_id}/thread/#{thread_id}/reopen", {_csrf: window.csrfToken}
_onCommentResolved = (thread_id, user) ->
thread = $scope.reviewPanel.commentThreads[thread_id]

View file

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

View file

@ -9,6 +9,7 @@ define [
threads : "="
docs : "="
onOpen : "&"
onUnresolve : "&"
isLoading : "="
link: (scope, element, attrs) ->
@ -22,6 +23,10 @@ define [
scope.resolvedCommentsPerFile = {}
scope.handleUnresolve = (threadId) ->
scope.onUnresolve({ threadId })
filterResolvedComments()
filterResolvedComments = () ->
scope.resolvedCommentsPerFile = {}
@ -31,6 +36,7 @@ define [
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.$watchCollection "entries", filterResolvedComments
scope.$watchCollection "threads", filterResolvedComments