diff --git a/app/coffee/modules/common/history.coffee b/app/coffee/modules/common/history.coffee index 81e9fb98..5af10bcf 100644 --- a/app/coffee/modules/common/history.coffee +++ b/app/coffee/modules/common/history.coffee @@ -32,19 +32,16 @@ module = angular.module("taigaCommon") class HistoryController extends taiga.Controller - @.$inject = ["$scope", "$tgRepo"] + @.$inject = ["$scope", "$tgRepo", "$tgResources"] - constructor: (@scope, @repo) -> + constructor: (@scope, @repo, @rs) -> initialize: (type, objectId) -> @.type = type @.objectId = objectId - getHistory: (type, objectId) -> - return @repo.queryOneRaw("history/#{type}", objectId) - - loadHistory: -> - return @.getHistory(@.type, @.objectId).then (history) => + loadHistory: (type, objectId) -> + return @rs.history.get(type, objectId).then (history) => for historyResult in history # If description was modified take only the description_html field if historyResult.values_diff.description_diff? @@ -56,6 +53,12 @@ class HistoryController extends taiga.Controller @scope.history = history @scope.comments = _.filter(history, (item) -> item.comment != "") + deleteComment: (type, objectId, activityId) -> + return @rs.history.deleteComment(type, objectId, activityId).then => @.loadHistory(type, objectId) + + undeleteComment: (type, objectId, activityId) -> + return @rs.history.undeleteComment(type, objectId, activityId).then => @.loadHistory(type, objectId) + HistoryDirective = ($log) -> templateChangeDiff = _.template(""" @@ -128,6 +131,21 @@ HistoryDirective = ($log) -> """) + templateDeletedComment = _.template(""" +