Remove loadHistory call from attachments event handlers.

And replace it with scope event raising. This change is needed
for conserve the previous behavior of history reloading on any
attachment change. The history reloading is now handled by
history directive and controler and them responds well to
'history:reload' signal.

Moreover, loadHistory repeated function is removed from
us/task/issue detail controllers.
stable
Andrey Antukh 2014-09-07 12:33:55 +02:00
parent 3f1eff581d
commit ed3967c1ab
3 changed files with 10 additions and 9 deletions

View File

@ -67,9 +67,9 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin, tai
@location.replace()
return @q.reject(xhr)
@scope.$on("attachment:create", => @.loadHistory())
@scope.$on("attachment:edit", => @.loadHistory())
@scope.$on("attachment:delete", => @.loadHistory())
@scope.$on("attachment:create", => @rootscope.$broadcast("history:reload"))
@scope.$on("attachment:edit", => @rootscope.$broadcast("history:reload"))
@scope.$on("attachment:delete", => @rootscope.$broadcast("history:reload"))
loadProject: ->
return @rs.projects.get(@scope.projectId).then (project) =>

View File

@ -59,9 +59,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
@scope.$on("attachment:create", => @rootscope.$broadcast("history:reload"))
@scope.$on("attachment:edit", => @rootscope.$broadcast("history:reload"))
@scope.$on("attachment:delete", => @rootscope.$broadcast("history:reload"))
loadProject: ->
return @rs.projects.get(@scope.projectId).then (project) =>

View File

@ -64,9 +64,9 @@ class UserStoryDetailController extends mixOf(taiga.Controller, taiga.PageMixin,
@location.replace()
return @q.reject(xhr)
@scope.$on("attachment:create", => @loadHistory())
@scope.$on("attachment:edit", => @loadHistory())
@scope.$on("attachment:delete", => @loadHistory())
@scope.$on("attachment:create", => @rootscope.$broadcast("history:reload"))
@scope.$on("attachment:edit", => @rootscope.$broadcast("history:reload"))
@scope.$on("attachment:delete", => @rootscope.$broadcast("history:reload"))
loadProject: ->
return @rs.projects.get(@scope.projectId).then (project) =>