Fix bug #1001 - Not list all attachments when a wiki page is created
parent
cc18d4ea62
commit
2661cc249e
|
@ -33,6 +33,7 @@ class AttachmentsController extends taiga.Controller
|
|||
_.bindAll(@)
|
||||
@.type = null
|
||||
@.objectId = null
|
||||
@.projectId = null
|
||||
|
||||
@.uploadingAttachments = []
|
||||
@.attachments = []
|
||||
|
@ -43,12 +44,14 @@ class AttachmentsController extends taiga.Controller
|
|||
initialize: (type, objectId) ->
|
||||
@.type = type
|
||||
@.objectId = objectId
|
||||
@.projectId = @scope.projectId
|
||||
|
||||
loadAttachments: ->
|
||||
urlname = "attachments/#{@.type}"
|
||||
id = @.objectId
|
||||
return @.attachments if not @.objectId
|
||||
|
||||
return @rs.attachments.list(urlname, id).then (attachments) =>
|
||||
urlname = "attachments/#{@.type}"
|
||||
|
||||
return @rs.attachments.list(urlname, @.objectId, @.projectId).then (attachments) =>
|
||||
@.attachments = _.sortBy(attachments, "order")
|
||||
@.updateCounters()
|
||||
return attachments
|
||||
|
@ -58,10 +61,9 @@ class AttachmentsController extends taiga.Controller
|
|||
@.deprecatedAttachmentsCount = _.filter(@.attachments, {is_deprecated: true}).length
|
||||
|
||||
_createAttachment: (attachment) ->
|
||||
projectId = @scope.projectId
|
||||
urlName = "attachments/#{@.type}"
|
||||
|
||||
promise = @rs.attachments.create(urlName, projectId, @.objectId, attachment)
|
||||
promise = @rs.attachments.create(urlName, @.projectId, @.objectId, attachment)
|
||||
promise = promise.then (data) =>
|
||||
data.isCreatedRightNow = true
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ sizeFormat = @.taiga.sizeFormat
|
|||
resourceProvider = ($rootScope, $urls, $model, $repo, $auth, $q) ->
|
||||
service = {}
|
||||
|
||||
service.list = (urlName, objectId) ->
|
||||
params = {object_id: objectId}
|
||||
service.list = (urlName, objectId, projectId) ->
|
||||
params = {object_id: objectId, project: projectId}
|
||||
return $repo.queryMany(urlName, params)
|
||||
|
||||
service.create = (urlName, projectId, objectId, file) ->
|
||||
|
|
|
@ -21,4 +21,4 @@ block content
|
|||
section.wysiwyg
|
||||
textarea(placeholder="Write a your wiki page", ng-model="wiki.content", tg-markitup)
|
||||
|
||||
tg-attachments(ng-model="wiki", type="wiki_page")
|
||||
tg-attachments(ng-model="wiki", type="wiki_page", ng-if="wiki.id")
|
||||
|
|
Loading…
Reference in New Issue