Move to current sprint implementation for backlog
parent
3747b1f7d3
commit
988675c310
|
@ -201,6 +201,39 @@ BacklogDirective = ($repo) ->
|
|||
onRemove: onRemoveItem
|
||||
})
|
||||
|
||||
##############################
|
||||
## Move to current sprint link
|
||||
##############################
|
||||
linkMoveToCurrentSprint = ($scope, $el, $attrs, $ctrl) ->
|
||||
|
||||
moveToCurrentSprint = (selectedUss) ->
|
||||
ussCurrent = _($scope.userstories)
|
||||
# Remove them from backlog
|
||||
$scope.userstories = ussCurrent.without.apply(ussCurrent, selectedUss).value()
|
||||
# Add them to current sprint
|
||||
$scope.sprints[0].user_stories = _.union(selectedUss, $scope.sprints[0].user_stories)
|
||||
$ctrl.filterVisibleUserstories()
|
||||
$repo.saveAll(selectedUss)
|
||||
|
||||
|
||||
# Enable move to current sprint only when there are selected us's
|
||||
$el.on "change", ".backlog-table-body .user-stories input:checkbox", (event) ->
|
||||
moveToCurrentSprintDom = $el.find("#move-to-current-sprint")
|
||||
if $el.find(".backlog-table-body .user-stories input:checkbox:checked").length > 0 and $scope.sprints.length > 0
|
||||
moveToCurrentSprintDom.show()
|
||||
else
|
||||
moveToCurrentSprintDom.hide()
|
||||
|
||||
$el.on "click", "#move-to-current-sprint", (event) =>
|
||||
# Calculating the us's to be modified
|
||||
ussDom = $el.find(".backlog-table-body .user-stories input:checkbox:checked")
|
||||
ussToMove = _.map ussDom, (item) ->
|
||||
itemScope = angular.element(item).scope()
|
||||
itemScope.us.milestone = $scope.sprints[0].id
|
||||
return itemScope.us
|
||||
|
||||
$scope.$apply(_.partial(moveToCurrentSprint, ussToMove))
|
||||
|
||||
#########################
|
||||
## Filters Link
|
||||
#########################
|
||||
|
@ -226,6 +259,7 @@ BacklogDirective = ($repo) ->
|
|||
link = ($scope, $el, $attrs) ->
|
||||
$ctrl = $el.controller()
|
||||
linkSortable($scope, $el, $attrs, $ctrl)
|
||||
linkMoveToCurrentSprint($scope, $el, $attrs, $ctrl)
|
||||
linkFilters($scope, $el, $attrs, $ctrl)
|
||||
|
||||
$scope.$on "$destroy", ->
|
||||
|
|
|
@ -12,7 +12,7 @@ block content
|
|||
include views/components/summary
|
||||
include views/modules/burndown
|
||||
div.backlog-menu
|
||||
a.trans-button(href="", title="Move to Current Sprint")
|
||||
a.trans-button.move-to-current-sprint(href="", title="Move to Current Sprint", id="move-to-current-sprint")
|
||||
span.icon.icon-move
|
||||
span.text Move to current Sprint
|
||||
a.trans-button(href="", title="Show Filters", id="show-filters-button")
|
||||
|
|
|
@ -14,5 +14,8 @@
|
|||
display: inline-block;
|
||||
margin-right: 1rem;
|
||||
padding: 4px 0;
|
||||
&.move-to-current-sprint {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue