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(@)
|
_.bindAll(@)
|
||||||
@.type = null
|
@.type = null
|
||||||
@.objectId = null
|
@.objectId = null
|
||||||
|
@.projectId = null
|
||||||
|
|
||||||
@.uploadingAttachments = []
|
@.uploadingAttachments = []
|
||||||
@.attachments = []
|
@.attachments = []
|
||||||
|
@ -43,12 +44,14 @@ class AttachmentsController extends taiga.Controller
|
||||||
initialize: (type, objectId) ->
|
initialize: (type, objectId) ->
|
||||||
@.type = type
|
@.type = type
|
||||||
@.objectId = objectId
|
@.objectId = objectId
|
||||||
|
@.projectId = @scope.projectId
|
||||||
|
|
||||||
loadAttachments: ->
|
loadAttachments: ->
|
||||||
urlname = "attachments/#{@.type}"
|
return @.attachments if not @.objectId
|
||||||
id = @.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")
|
@.attachments = _.sortBy(attachments, "order")
|
||||||
@.updateCounters()
|
@.updateCounters()
|
||||||
return attachments
|
return attachments
|
||||||
|
@ -58,10 +61,9 @@ class AttachmentsController extends taiga.Controller
|
||||||
@.deprecatedAttachmentsCount = _.filter(@.attachments, {is_deprecated: true}).length
|
@.deprecatedAttachmentsCount = _.filter(@.attachments, {is_deprecated: true}).length
|
||||||
|
|
||||||
_createAttachment: (attachment) ->
|
_createAttachment: (attachment) ->
|
||||||
projectId = @scope.projectId
|
|
||||||
urlName = "attachments/#{@.type}"
|
urlName = "attachments/#{@.type}"
|
||||||
|
|
||||||
promise = @rs.attachments.create(urlName, projectId, @.objectId, attachment)
|
promise = @rs.attachments.create(urlName, @.projectId, @.objectId, attachment)
|
||||||
promise = promise.then (data) =>
|
promise = promise.then (data) =>
|
||||||
data.isCreatedRightNow = true
|
data.isCreatedRightNow = true
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ sizeFormat = @.taiga.sizeFormat
|
||||||
resourceProvider = ($rootScope, $urls, $model, $repo, $auth, $q) ->
|
resourceProvider = ($rootScope, $urls, $model, $repo, $auth, $q) ->
|
||||||
service = {}
|
service = {}
|
||||||
|
|
||||||
service.list = (urlName, objectId) ->
|
service.list = (urlName, objectId, projectId) ->
|
||||||
params = {object_id: objectId}
|
params = {object_id: objectId, project: projectId}
|
||||||
return $repo.queryMany(urlName, params)
|
return $repo.queryMany(urlName, params)
|
||||||
|
|
||||||
service.create = (urlName, projectId, objectId, file) ->
|
service.create = (urlName, projectId, objectId, file) ->
|
||||||
|
|
|
@ -21,4 +21,4 @@ block content
|
||||||
section.wysiwyg
|
section.wysiwyg
|
||||||
textarea(placeholder="Write a your wiki page", ng-model="wiki.content", tg-markitup)
|
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