Merge pull request #1313 from taigaio/fixing-ordering-on-archived
Fixing ordering in archived statesstable
commit
5b59792b91
|
@ -89,7 +89,6 @@ class KanbanUserstoriesService extends taiga.Service
|
||||||
@.order[it.id] = it.kanban_order for it in @.userstoriesRaw
|
@.order[it.id] = it.kanban_order for it in @.userstoriesRaw
|
||||||
|
|
||||||
assignOrders: (order) ->
|
assignOrders: (order) ->
|
||||||
order = _.invert(order)
|
|
||||||
@.order = _.assign(@.order, order)
|
@.order = _.assign(@.order, order)
|
||||||
|
|
||||||
@.refresh()
|
@.refresh()
|
||||||
|
@ -117,8 +116,10 @@ class KanbanUserstoriesService extends taiga.Service
|
||||||
for it in previousWithTheSameOrder
|
for it in previousWithTheSameOrder
|
||||||
setOrders[it.id] = @.order[it.id]
|
setOrders[it.id] = @.order[it.id]
|
||||||
|
|
||||||
if !previous
|
if !previous and (!afterDestination or afterDestination.length == 0)
|
||||||
@.order[us.id] = 0
|
@.order[us.id] = 0
|
||||||
|
else if !previous and afterDestination and afterDestination.length > 0
|
||||||
|
@.order[us.id] = @.order[afterDestination[0].id] - 1
|
||||||
else if previous
|
else if previous
|
||||||
@.order[us.id] = @.order[previous.id] + 1
|
@.order[us.id] = @.order[previous.id] + 1
|
||||||
|
|
||||||
|
@ -132,6 +133,18 @@ class KanbanUserstoriesService extends taiga.Service
|
||||||
|
|
||||||
return {"us_id": us.id, "order": @.order[us.id], "set_orders": setOrders}
|
return {"us_id": us.id, "order": @.order[us.id], "set_orders": setOrders}
|
||||||
|
|
||||||
|
moveToEnd: (id, statusId) ->
|
||||||
|
us = @.getUsModel(id)
|
||||||
|
|
||||||
|
@.order[us.id] = -1
|
||||||
|
|
||||||
|
us.status = statusId
|
||||||
|
us.kanban_order = @.order[us.id]
|
||||||
|
|
||||||
|
@.refresh()
|
||||||
|
|
||||||
|
return {"us_id": us.id, "order": -1}
|
||||||
|
|
||||||
replace: (us) ->
|
replace: (us) ->
|
||||||
@.usByStatus = @.usByStatus.map (status) ->
|
@.usByStatus = @.usByStatus.map (status) ->
|
||||||
findedIndex = status.findIndex (usItem) ->
|
findedIndex = status.findIndex (usItem) ->
|
||||||
|
|
|
@ -293,7 +293,10 @@ class KanbanController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fi
|
||||||
|
|
||||||
moveUs: (ctx, us, oldStatusId, newStatusId, index) ->
|
moveUs: (ctx, us, oldStatusId, newStatusId, index) ->
|
||||||
us = @kanbanUserstoriesService.getUsModel(us.get('id'))
|
us = @kanbanUserstoriesService.getUsModel(us.get('id'))
|
||||||
|
newStatus = @scope.usStatusById[newStatusId]
|
||||||
|
if newStatus.is_archived and !@scope.usByStatus.get(newStatusId.toString())
|
||||||
|
moveUpdateData = @kanbanUserstoriesService.moveToEnd(us.id, newStatusId)
|
||||||
|
else
|
||||||
moveUpdateData = @kanbanUserstoriesService.move(us.id, newStatusId, index)
|
moveUpdateData = @kanbanUserstoriesService.move(us.id, newStatusId, index)
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
|
|
Loading…
Reference in New Issue