From c28d43716fa86cc52b3a4ccb5f694f73107d2d44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Tue, 12 Aug 2014 10:49:40 +0200 Subject: [PATCH] Allowing kanban ordering only when backlog isn't activated --- app/coffee/modules/kanban/main.coffee | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/coffee/modules/kanban/main.coffee b/app/coffee/modules/kanban/main.coffee index 7c1acdb7..96006b0c 100644 --- a/app/coffee/modules/kanban/main.coffee +++ b/app/coffee/modules/kanban/main.coffee @@ -150,7 +150,7 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi .then(=> @scope.$broadcast("redraw:wip")) prepareBulkUpdateData: (uses) -> - return _.map(uses, (x) -> {"us_id": x.id, "order": x.order}) + return _.map(uses, (x) -> {"us_id": x.id, "order": x.order}) resortUserStories: (uses) -> items = [] @@ -171,6 +171,12 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi @scope.usByStatus[statusId].splice(index, 0, us) us.status = statusId + else if not @scope.project.is_backlog_activated + current_position = @scope.usByStatus[us.status].indexOf(us) + new_position = index + + @scope.usByStatus[us.status].splice(current_position, 1) + @scope.usByStatus[us.status].splice(new_position, 0, us) # Persist the userstory promise = @repo.save(us)