Remove one level of indentation on backlog sortable module.

stable
Andrey Antukh 2014-09-05 22:14:51 +02:00
parent 5ec1925057
commit c5958ba32d
1 changed files with 35 additions and 35 deletions

View File

@ -39,7 +39,6 @@ deleteElement = (el) ->
el.off() el.off()
el.remove() el.remove()
BacklogSortableDirective = ($repo, $rs, $rootscope) -> BacklogSortableDirective = ($repo, $rs, $rootscope) ->
# Notes about jquery bug: # Notes about jquery bug:
# http://stackoverflow.com/questions/5791886/jquery-draggable-shows- # http://stackoverflow.com/questions/5791886/jquery-draggable-shows-
@ -48,46 +47,47 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) ->
link = ($scope, $el, $attrs) -> link = ($scope, $el, $attrs) ->
bindOnce $scope, "project", (project) -> bindOnce $scope, "project", (project) ->
# If the user has not enough permissions we don't enable the sortable # If the user has not enough permissions we don't enable the sortable
if project.my_permissions.indexOf("modify_us") > -1 if not (project.my_permissions.indexOf("modify_us") > -1)
return
$el.sortable({ $el.sortable({
connectWith: ".sprint-table" connectWith: ".sprint-table"
containment: ".wrapper" containment: ".wrapper"
dropOnEmpty: true dropOnEmpty: true
placeholder: "row us-item-row us-item-drag sortable-placeholder" placeholder: "row us-item-row us-item-drag sortable-placeholder"
# With scroll activated, it has strange behavior # With scroll activated, it has strange behavior
# with not full screen browser window. # with not full screen browser window.
scroll: false scroll: false
# A consequence of length of backlog user story item # A consequence of length of backlog user story item
# the default tolerance ("intersection") not works properly. # the default tolerance ("intersection") not works properly.
tolerance: "pointer" tolerance: "pointer"
# Revert on backlog is disabled bacause it works bad. Something # Revert on backlog is disabled bacause it works bad. Something
# on the current taiga backlog structure or style makes jquery ui # on the current taiga backlog structure or style makes jquery ui
# works unexpectly (in some circumstances calculates wrong # works unexpectly (in some circumstances calculates wrong
# position for revert). # position for revert).
revert: false revert: false
}) })
$el.on "sortreceive", (event, ui) -> $el.on "sortreceive", (event, ui) ->
itemUs = ui.item.scope().us itemUs = ui.item.scope().us
itemIndex = ui.item.index() itemIndex = ui.item.index()
deleteElement(ui.item) deleteElement(ui.item)
$scope.$emit("sprint:us:move", itemUs, itemIndex, null) $scope.$emit("sprint:us:move", itemUs, itemIndex, null)
ui.item.find('a').removeClass('noclick') ui.item.find('a').removeClass('noclick')
$el.on "sortstop", (event, ui) -> $el.on "sortstop", (event, ui) ->
# When parent not exists, do nothing # When parent not exists, do nothing
if ui.item.parent().length == 0 if ui.item.parent().length == 0
return return
itemUs = ui.item.scope().us itemUs = ui.item.scope().us
itemIndex = ui.item.index() itemIndex = ui.item.index()
$scope.$emit("sprint:us:move", itemUs, itemIndex, null) $scope.$emit("sprint:us:move", itemUs, itemIndex, null)
ui.item.find('a').removeClass('noclick') ui.item.find('a').removeClass('noclick')
$el.on "sortstart", (event, ui) -> $el.on "sortstart", (event, ui) ->
ui.item.find('a').addClass('noclick') ui.item.find('a').addClass('noclick')
$scope.$on "$destroy", -> $scope.$on "$destroy", ->
$el.off() $el.off()