Fix #745: Reload history when add, update or delete attachments

stable
David Barragán Merino 2014-08-22 12:54:11 +02:00
parent 0b176d2f70
commit dce3e9873f
4 changed files with 18 additions and 3 deletions

View File

@ -126,13 +126,16 @@ class AttachmentsMixin
onCreateAttachment: (attachment) ->
@scope.attachments[@scope.attachments.length] = attachment
@.updateAttachmentsCounters()
@scope.$emit("attachment:create")
onEditAttachment: (attachment) ->
@.updateAttachmentsCounters()
@scope.$emit("attachment:edit")
onDeleteAttachment: (attachment) ->
index = @scope.attachments.indexOf(attachment)
@scope.attachments.splice(index, 1)
@.updateAttachmentsCounters()
@scope.$emit("attachment:delete")
taiga.AttachmentsMixin = AttachmentsMixin

View File

@ -61,6 +61,10 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin, tai
promise.then null, ->
console.log "FAIL" #TODO
@scope.$on "attachment:create", @loadHistory
@scope.$on "attachment:edit", @loadHistory
@scope.$on "attachment:delete", @loadHistory
loadProject: ->
return @rs.projects.get(@scope.projectId).then (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.nextUrl = "/project/#{projSlug}/issue/#{next.ref}" if next.id?
loadHistory: ->
loadHistory: =>
return @rs.issues.history(@scope.issueId).then (history) =>
_.each history.results, (historyResult) ->
#If description was modified take only the description_html field

View File

@ -58,6 +58,10 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin, taig
promise.then null, ->
console.log "FAIL" #TODO
@scope.$on "attachment:create", @loadHistory
@scope.$on "attachment:edit", @loadHistory
@scope.$on "attachment:delete", @loadHistory
loadProject: ->
return @rs.projects.get(@scope.projectId).then (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.nextUrl = "/project/#{projSlug}/task/#{next.ref}" if next.id?
loadHistory: ->
loadHistory: =>
return @rs.tasks.history(@scope.taskId).then (history) =>
_.each history.results, (historyResult) ->
#If description was modified take only the description_html field

View File

@ -59,6 +59,10 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin,
promise.then null, ->
console.log "FAIL" #TODO
@scope.$on "attachment:create", @loadHistory
@scope.$on "attachment:edit", @loadHistory
@scope.$on "attachment:delete", @loadHistory
loadProject: ->
return @rs.projects.get(@scope.projectId).then (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) =>
@scope.tasks = tasks
loadHistory: ->
loadHistory: =>
return @rs.userstories.history(@scope.usId).then (history) =>
_.each history.results, (historyResult) ->
#If description was modified take only the description_html field