if the user check one item in the backlog the items between this item and the last one will be check
parent
d74e8f635d
commit
e5a0b3fdb3
|
@ -603,9 +603,11 @@ BacklogDirective = ($repo, $rootscope, $translate) ->
|
|||
$ctrl.loadProjectStats()
|
||||
|
||||
|
||||
# Enable move to current sprint only when there are selected us's
|
||||
$el.on "change", ".backlog-table-body .user-stories input:checkbox", (event) ->
|
||||
target = angular.element(event.currentTarget)
|
||||
shiftPressed = false
|
||||
lastChecked = null
|
||||
|
||||
checkSelected = (target) ->
|
||||
lastChecked = target.closest(".us-item-row")
|
||||
moveToCurrentSprintDom = $el.find("#move-to-current-sprint")
|
||||
selectedUsDom = $el.find(".backlog-table-body .user-stories input:checkbox:checked")
|
||||
|
||||
|
@ -616,6 +618,33 @@ BacklogDirective = ($repo, $rootscope, $translate) ->
|
|||
|
||||
target.closest('.us-item-row').toggleClass('ui-multisortable-multiple')
|
||||
|
||||
$(window).on "keydown.shift-pressed keyup.shift-pressed", (event) ->
|
||||
shiftPressed = !!event.shiftKey
|
||||
|
||||
return true
|
||||
|
||||
# Enable move to current sprint only when there are selected us's
|
||||
$el.on "change", ".backlog-table-body .user-stories input:checkbox", (event) ->
|
||||
# check elements between the last two if shift is pressed
|
||||
if lastChecked && shiftPressed
|
||||
elements = []
|
||||
current = $(event.currentTarget).closest(".us-item-row")
|
||||
nextAll = lastChecked.nextAll()
|
||||
prevAll = lastChecked.prevAll()
|
||||
|
||||
if _.some(nextAll, (next) -> next == current[0])
|
||||
elements = lastChecked.nextUntil(current)
|
||||
else if _.some(prevAll, (prev) -> prev == current[0])
|
||||
elements = lastChecked.prevUntil(current)
|
||||
|
||||
_.map elements, (elm) ->
|
||||
input = $(elm).find("input:checkbox")
|
||||
input.prop('checked', true);
|
||||
checkSelected(input)
|
||||
|
||||
target = angular.element(event.currentTarget)
|
||||
checkSelected(target)
|
||||
|
||||
$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")
|
||||
|
@ -701,6 +730,7 @@ BacklogDirective = ($repo, $rootscope, $translate) ->
|
|||
|
||||
$scope.$on "$destroy", ->
|
||||
$el.off()
|
||||
$(window).off(".shift-pressed")
|
||||
|
||||
return {link: link}
|
||||
|
||||
|
|
Loading…
Reference in New Issue