Fix an error with the new created attachments

stable
David Barragán Merino 2014-08-01 13:49:48 +02:00
parent 5a2492f6f1
commit c74f21824b
2 changed files with 9 additions and 6 deletions

View File

@ -235,6 +235,7 @@ AttachmentDirective = ($log, $repo, $confirm) ->
attachment = $scope.$eval($attrs.tgAttachment)
render(attachment, attachment.isCreatedRightNow)
delete attachment.isCreatedRightNow
###########
## Actions (on view mode)
@ -246,8 +247,8 @@ AttachmentDirective = ($log, $repo, $confirm) ->
$el.on "click", "a.settings.icon-delete", (event) ->
event.preventDefault()
title = "Delete attachment" # i18n
subtitle = "the attachment '#{attachment.name}'"
title = "Delete attachment" #TODO: i18in
subtitle = "the attachment '#{attachment.name}'" #TODO: i18in
onSuccess = ->
$ctrl.loadAttachments(attachment.object_id)

View File

@ -24,7 +24,7 @@ taiga = @.taiga
sizeFormat = @.taiga.sizeFormat
resourceProvider = ($rootScope, $urls, $repo, $auth, $q) ->
resourceProvider = ($rootScope, $urls, $model, $repo, $auth, $q) ->
service = {}
service.list = (urlName, objectId) ->
@ -52,7 +52,9 @@ resourceProvider = ($rootScope, $urls, $repo, $auth, $q) ->
data = JSON.parse(evt.target.responseText)
catch
data = {}
defered.resolve(data)
model = $model.make_model(urlName, data)
defered.resolve(model)
uploadFailed = (evt) =>
$rootScope.$apply ->
@ -81,5 +83,5 @@ resourceProvider = ($rootScope, $urls, $repo, $auth, $q) ->
module = angular.module("taigaResources")
module.factory("$tgAttachmentsResourcesProvider", ["$rootScope", "$tgUrls", "$tgRepo", "$tgAuth", "$q",
resourceProvider])
module.factory("$tgAttachmentsResourcesProvider", ["$rootScope", "$tgUrls", "$tgModel", "$tgRepo", "$tgAuth",
"$q", resourceProvider])