From ed3967c1ab696edbecd18796fcff9f46254a1144 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Sun, 7 Sep 2014 12:33:55 +0200 Subject: [PATCH] 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. --- app/coffee/modules/issues/detail.coffee | 6 +++--- app/coffee/modules/tasks/detail.coffee | 7 ++++--- app/coffee/modules/userstories/detail.coffee | 6 +++--- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/coffee/modules/issues/detail.coffee b/app/coffee/modules/issues/detail.coffee index 0f0ea79c..35a06c0e 100644 --- a/app/coffee/modules/issues/detail.coffee +++ b/app/coffee/modules/issues/detail.coffee @@ -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) => diff --git a/app/coffee/modules/tasks/detail.coffee b/app/coffee/modules/tasks/detail.coffee index f2d4e886..c1f08250 100644 --- a/app/coffee/modules/tasks/detail.coffee +++ b/app/coffee/modules/tasks/detail.coffee @@ -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) => diff --git a/app/coffee/modules/userstories/detail.coffee b/app/coffee/modules/userstories/detail.coffee index 70e32692..a4f6c344 100644 --- a/app/coffee/modules/userstories/detail.coffee +++ b/app/coffee/modules/userstories/detail.coffee @@ -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) =>