Fix #745: Reload history when add, update or delete attachments
parent
0b176d2f70
commit
dce3e9873f
|
@ -126,13 +126,16 @@ class AttachmentsMixin
|
||||||
onCreateAttachment: (attachment) ->
|
onCreateAttachment: (attachment) ->
|
||||||
@scope.attachments[@scope.attachments.length] = attachment
|
@scope.attachments[@scope.attachments.length] = attachment
|
||||||
@.updateAttachmentsCounters()
|
@.updateAttachmentsCounters()
|
||||||
|
@scope.$emit("attachment:create")
|
||||||
|
|
||||||
onEditAttachment: (attachment) ->
|
onEditAttachment: (attachment) ->
|
||||||
@.updateAttachmentsCounters()
|
@.updateAttachmentsCounters()
|
||||||
|
@scope.$emit("attachment:edit")
|
||||||
|
|
||||||
onDeleteAttachment: (attachment) ->
|
onDeleteAttachment: (attachment) ->
|
||||||
index = @scope.attachments.indexOf(attachment)
|
index = @scope.attachments.indexOf(attachment)
|
||||||
@scope.attachments.splice(index, 1)
|
@scope.attachments.splice(index, 1)
|
||||||
@.updateAttachmentsCounters()
|
@.updateAttachmentsCounters()
|
||||||
|
@scope.$emit("attachment:delete")
|
||||||
|
|
||||||
taiga.AttachmentsMixin = AttachmentsMixin
|
taiga.AttachmentsMixin = AttachmentsMixin
|
||||||
|
|
|
@ -61,6 +61,10 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin, tai
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
console.log "FAIL" #TODO
|
console.log "FAIL" #TODO
|
||||||
|
|
||||||
|
@scope.$on "attachment:create", @loadHistory
|
||||||
|
@scope.$on "attachment:edit", @loadHistory
|
||||||
|
@scope.$on "attachment:delete", @loadHistory
|
||||||
|
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
@ -88,7 +92,7 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin, tai
|
||||||
@scope.previousUrl = "/project/#{projSlug}/issue/#{prev.ref}" if prev.id?
|
@scope.previousUrl = "/project/#{projSlug}/issue/#{prev.ref}" if prev.id?
|
||||||
@scope.nextUrl = "/project/#{projSlug}/issue/#{next.ref}" if next.id?
|
@scope.nextUrl = "/project/#{projSlug}/issue/#{next.ref}" if next.id?
|
||||||
|
|
||||||
loadHistory: ->
|
loadHistory: =>
|
||||||
return @rs.issues.history(@scope.issueId).then (history) =>
|
return @rs.issues.history(@scope.issueId).then (history) =>
|
||||||
_.each history.results, (historyResult) ->
|
_.each history.results, (historyResult) ->
|
||||||
#If description was modified take only the description_html field
|
#If description was modified take only the description_html field
|
||||||
|
|
|
@ -58,6 +58,10 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin, taig
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
console.log "FAIL" #TODO
|
console.log "FAIL" #TODO
|
||||||
|
|
||||||
|
@scope.$on "attachment:create", @loadHistory
|
||||||
|
@scope.$on "attachment:edit", @loadHistory
|
||||||
|
@scope.$on "attachment:delete", @loadHistory
|
||||||
|
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
@ -79,7 +83,7 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin, taig
|
||||||
@scope.previousUrl = "/project/#{projSlug}/task/#{prev.ref}" if prev.id?
|
@scope.previousUrl = "/project/#{projSlug}/task/#{prev.ref}" if prev.id?
|
||||||
@scope.nextUrl = "/project/#{projSlug}/task/#{next.ref}" if next.id?
|
@scope.nextUrl = "/project/#{projSlug}/task/#{next.ref}" if next.id?
|
||||||
|
|
||||||
loadHistory: ->
|
loadHistory: =>
|
||||||
return @rs.tasks.history(@scope.taskId).then (history) =>
|
return @rs.tasks.history(@scope.taskId).then (history) =>
|
||||||
_.each history.results, (historyResult) ->
|
_.each history.results, (historyResult) ->
|
||||||
#If description was modified take only the description_html field
|
#If description was modified take only the description_html field
|
||||||
|
|
|
@ -59,6 +59,10 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin,
|
||||||
promise.then null, ->
|
promise.then null, ->
|
||||||
console.log "FAIL" #TODO
|
console.log "FAIL" #TODO
|
||||||
|
|
||||||
|
@scope.$on "attachment:create", @loadHistory
|
||||||
|
@scope.$on "attachment:edit", @loadHistory
|
||||||
|
@scope.$on "attachment:delete", @loadHistory
|
||||||
|
|
||||||
loadProject: ->
|
loadProject: ->
|
||||||
return @rs.projects.get(@scope.projectId).then (project) =>
|
return @rs.projects.get(@scope.projectId).then (project) =>
|
||||||
@scope.project = project
|
@scope.project = project
|
||||||
|
@ -87,7 +91,7 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin,
|
||||||
return @rs.tasks.list(@scope.projectId, null, @scope.usId).then (tasks) =>
|
return @rs.tasks.list(@scope.projectId, null, @scope.usId).then (tasks) =>
|
||||||
@scope.tasks = tasks
|
@scope.tasks = tasks
|
||||||
|
|
||||||
loadHistory: ->
|
loadHistory: =>
|
||||||
return @rs.userstories.history(@scope.usId).then (history) =>
|
return @rs.userstories.history(@scope.usId).then (history) =>
|
||||||
_.each history.results, (historyResult) ->
|
_.each history.results, (historyResult) ->
|
||||||
#If description was modified take only the description_html field
|
#If description was modified take only the description_html field
|
||||||
|
|
Loading…
Reference in New Issue