diff --git a/app/modules/components/wysiwyg/comment-wysiwyg.directive.coffee b/app/modules/components/wysiwyg/comment-wysiwyg.directive.coffee index b40858e2..94cf6512 100644 --- a/app/modules/components/wysiwyg/comment-wysiwyg.directive.coffee +++ b/app/modules/components/wysiwyg/comment-wysiwyg.directive.coffee @@ -17,18 +17,19 @@ # File: components/wysiwyg/comment-wysiwyg.directive.coffee ### -CommentWysiwyg = ($modelTransform, $rootscope, $confirm, attachmentsFullService) -> +CommentWysiwyg = ($modelTransform, $rootscope, attachmentsFullService) -> link = ($scope, $el, $attrs) -> $scope.editableDescription = false $scope.saveComment = (description, cb) -> $scope.content = '' - $scope.type.comment = description + $scope.vm.type.comment = description transform = $modelTransform.save (item) -> return transform.then -> - if $scope.onAddComment - $scope.onAddComment() + if $scope.vm.onAddComment + $scope.vm.onAddComment() + $rootscope.$broadcast("object:updated") transform.finally(cb) types = { @@ -39,11 +40,11 @@ CommentWysiwyg = ($modelTransform, $rootscope, $confirm, attachmentsFullService) } uploadFile = (file, cb) -> - return attachmentsFullService.addAttachment($scope.vm.projectId, $scope.type.id, types[$scope.type._name], file, true, true).then (result) -> + return attachmentsFullService.addAttachment($scope.vm.projectId, $scope.vm.type.id, types[$scope.vm.type._name], file, true, true).then (result) -> cb(result.getIn(['file', 'name']), result.getIn(['file', 'url'])) $scope.onChange = (markdown) -> - $scope.type.comment = markdown + $scope.vm.type.comment = markdown $scope.uploadFiles = (files, cb) -> for file in files @@ -51,16 +52,13 @@ CommentWysiwyg = ($modelTransform, $rootscope, $confirm, attachmentsFullService) $scope.content = '' - $scope.$watch "type", (value) -> + $scope.$watch "vm.type", (value) -> return if not value $scope.storageKey = "comment-" + value.project + "-" + value.id + "-" + value._name return { - scope: { - type: '=', - onAddComment: '&' - }, + scope: true, link: link, template: """
diff --git a/app/modules/history/comments/comments.jade b/app/modules/history/comments/comments.jade index 24d6e790..58bae7f3 100644 --- a/app/modules/history/comments/comments.jade +++ b/app/modules/history/comments/comments.jade @@ -18,6 +18,5 @@ section.comments tg-comment-wysiwyg( tg-check-permission="{{::vm.canAddCommentPermission}}" - on-add-comment="vm.onAddComment()" type="vm.type" )