Minor changes on taskboard an and task resources.

stable
Andrey Antukh 2014-07-09 19:08:05 +02:00
parent a5ebac4560
commit 859075bd76
3 changed files with 12 additions and 13 deletions

View File

@ -33,7 +33,8 @@ resourceProvider = ($repo, $http, $urls) ->
service.bulkCreate = (projectId, usId, data) ->
url = $urls.resolve("bulk-create-tasks")
params = {projectId: projectId, usId: usId, bulkTasks: data}
return $http.post(url, params)
return $http.post(url, params).then (result) ->
return result.data
return (instance) ->
instance.tasks = service

View File

@ -125,11 +125,15 @@ CreateBulkTasksDirective = ($repo, $rs, $rootscope) ->
projectId = $scope.projectId
usId = $scope.form.usId
# FIXME: error handling?
$rs.tasks.bulkCreate(projectId, usId, data).then (result) ->
promise = $rs.tasks.bulkCreate(projectId, usId, data)
promise.then (result) ->
$rootscope.$broadcast("taskform:bulk:success", result)
$el.addClass("hidden")
# TODO: error handling
promise.then null, ->
console.log "FAIL"
$scope.$on "$destroy", ->
$el.off()

View File

@ -52,16 +52,10 @@ class TaskboardController extends mixOf(taiga.Controller, taiga.PageMixin)
promise.then null, ->
console.log "FAIL" #TODO
@scope.$on "taskform:new:success", =>
@.loadTaskboard()
@scope.$on "taskform:bulk:success", =>
@.loadTaskboard()
@scope.$on "taskform:edit:success", =>
@.loadTaskboard()
@scope.$on "assigned-to:added", (ctx, task) =>
@scope.$apply(
@repo.save(task)
)
@scope.$on("taskform:new:success", => @.loadTaskboard())
@scope.$on("taskform:bulk:success", => @.loadTaskboard())
@scope.$on("taskform:edit:success", => @.loadTaskboard())
@scope.$on("assigned-to:added", (task) => @scope.$apply(=> @repo.save(task)))
loadSprintStats: ->
return @rs.sprints.stats(@scope.projectId, @scope.sprintId).then (stats) =>