Fix uploadfile in comments
parent
bd56b45516
commit
a02d24ee1e
|
@ -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: """
|
||||
<div>
|
||||
|
|
|
@ -18,6 +18,5 @@ section.comments
|
|||
|
||||
tg-comment-wysiwyg(
|
||||
tg-check-permission="{{::vm.canAddCommentPermission}}"
|
||||
on-add-comment="vm.onAddComment()"
|
||||
type="vm.type"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue