From c5958ba32d7e4ed65fe4b9b014f4071e23be7a0d Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 5 Sep 2014 22:14:51 +0200 Subject: [PATCH] Remove one level of indentation on backlog sortable module. --- app/coffee/modules/backlog/sortable.coffee | 70 +++++++++++----------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/app/coffee/modules/backlog/sortable.coffee b/app/coffee/modules/backlog/sortable.coffee index 1e02e85b..70cfcbb1 100644 --- a/app/coffee/modules/backlog/sortable.coffee +++ b/app/coffee/modules/backlog/sortable.coffee @@ -39,7 +39,6 @@ deleteElement = (el) -> el.off() el.remove() - BacklogSortableDirective = ($repo, $rs, $rootscope) -> # Notes about jquery bug: # http://stackoverflow.com/questions/5791886/jquery-draggable-shows- @@ -48,46 +47,47 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) -> link = ($scope, $el, $attrs) -> bindOnce $scope, "project", (project) -> # 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({ - connectWith: ".sprint-table" - containment: ".wrapper" - dropOnEmpty: true - placeholder: "row us-item-row us-item-drag sortable-placeholder" - # With scroll activated, it has strange behavior - # with not full screen browser window. - scroll: false - # A consequence of length of backlog user story item - # the default tolerance ("intersection") not works properly. - tolerance: "pointer" - # Revert on backlog is disabled bacause it works bad. Something - # on the current taiga backlog structure or style makes jquery ui - # works unexpectly (in some circumstances calculates wrong - # position for revert). - revert: false - }) + $el.sortable({ + connectWith: ".sprint-table" + containment: ".wrapper" + dropOnEmpty: true + placeholder: "row us-item-row us-item-drag sortable-placeholder" + # With scroll activated, it has strange behavior + # with not full screen browser window. + scroll: false + # A consequence of length of backlog user story item + # the default tolerance ("intersection") not works properly. + tolerance: "pointer" + # Revert on backlog is disabled bacause it works bad. Something + # on the current taiga backlog structure or style makes jquery ui + # works unexpectly (in some circumstances calculates wrong + # position for revert). + revert: false + }) - $el.on "sortreceive", (event, ui) -> - itemUs = ui.item.scope().us - itemIndex = ui.item.index() + $el.on "sortreceive", (event, ui) -> + itemUs = ui.item.scope().us + itemIndex = ui.item.index() - deleteElement(ui.item) - $scope.$emit("sprint:us:move", itemUs, itemIndex, null) - ui.item.find('a').removeClass('noclick') + deleteElement(ui.item) + $scope.$emit("sprint:us:move", itemUs, itemIndex, null) + ui.item.find('a').removeClass('noclick') - $el.on "sortstop", (event, ui) -> - # When parent not exists, do nothing - if ui.item.parent().length == 0 - return + $el.on "sortstop", (event, ui) -> + # When parent not exists, do nothing + if ui.item.parent().length == 0 + return - itemUs = ui.item.scope().us - itemIndex = ui.item.index() - $scope.$emit("sprint:us:move", itemUs, itemIndex, null) - ui.item.find('a').removeClass('noclick') + itemUs = ui.item.scope().us + itemIndex = ui.item.index() + $scope.$emit("sprint:us:move", itemUs, itemIndex, null) + ui.item.find('a').removeClass('noclick') - $el.on "sortstart", (event, ui) -> - ui.item.find('a').addClass('noclick') + $el.on "sortstart", (event, ui) -> + ui.item.find('a').addClass('noclick') $scope.$on "$destroy", -> $el.off()