Now assigned to change is persisted on kanban.

stable
Andrey Antukh 2014-07-23 14:34:28 +02:00
parent 649e610f90
commit 9f37ce70ec
1 changed files with 30 additions and 26 deletions

View File

@ -54,16 +54,39 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
promise.then null, =>
console.log "FAIL"
# @scope.$on("usform:bulk:success", @.loadUserstories)
# @scope.$on("sprintform:create:success", @.loadSprints)
# @scope.$on("sprintform:create:success", @.loadProjectStats)
# @scope.$on("sprintform:remove:success", @.loadSprints)
# @scope.$on("sprintform:remove:success", @.loadProjectStats)
@scope.$on("usform:new:success", @.onNewUserstory)
@scope.$on("usform:edit:success", @.onUserstoryEdited)
@scope.$on("assigned-to:added", @.onAssignedToChanged)
@scope.$on("kanban:us:move", @.moveUs)
# @scope.$on("sprint:us:moved", @.loadSprints)
# @scope.$on("sprint:us:moved", @.loadProjectStats)
# Template actions
editUserStory: (us) ->
@rootscope.$broadcast("usform:edit", us)
addNewUs: (type, statusId) ->
switch type
when "standard" then @rootscope.$broadcast("usform:new", statusId)
when "bulk" then @rootscope.$broadcast("usform:bulk", statusId)
changeUsAssignedTo: (us) ->
@rootscope.$broadcast("assigned-to:add", us)
# Scope Events Handlers
onNewUserstory: (ctx, us) ->
@scope.usByStatus[us.status].splice(0, 0, us)
onAssignedToChanged: (ctx, userid, us) ->
us.assigned_to = userid
promise = @repo.save(us)
promise.then null, ->
console.log "FAIL" # TODO
onUserstoryEdited: (ctx, us) ->
@.loadUserstories()
# Load data methods
loadProjectStats: ->
return @rs.projects.stats(@scope.projectId).then (stats) =>
@ -156,25 +179,6 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
return promise
## Template actions
editUserStory: (us) ->
@rootscope.$broadcast("usform:edit", us)
addNewUs: (type, statusId) ->
switch type
when "standard" then @rootscope.$broadcast("usform:new", statusId)
when "bulk" then @rootscope.$broadcast("usform:bulk", statusId)
changeUsAssignedTo: (us) ->
@rootscope.$broadcast("assigned-to:add", us)
# Scope Events Handlers
onNewUserstory: (ctx, us) ->
@scope.usByStatus[us.status].splice(0, 0, us)
onUserstoryEdited: (ctx, us) ->
@.loadUserstories()
module.controller("KanbanController", KanbanController)