mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
33 lines
952 B
CoffeeScript
33 lines
952 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.directive "resolvedCommentsDropdown", () ->
|
|
restrict: "E"
|
|
templateUrl: "resolvedCommentsDropdownTemplate"
|
|
scope:
|
|
entries : "="
|
|
threads : "="
|
|
docs : "="
|
|
link: (scope, element, attrs) ->
|
|
scope.state =
|
|
isOpen: false
|
|
|
|
scope.resolvedCommentsPerFile = {}
|
|
|
|
filterResolvedComments = () ->
|
|
scope.resolvedCommentsPerFile = {}
|
|
|
|
for fileId, fileEntries of scope.entries
|
|
scope.resolvedCommentsPerFile[fileId] = {}
|
|
for entryId, entry of fileEntries
|
|
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
|
|
|
|
console.log scope.resolvedCommentsPerFile
|
|
|
|
|
|
scope.$watchCollection "entries", filterResolvedComments
|
|
scope.$watchCollection "threads", filterResolvedComments
|
|
|
|
|