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

View File

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