limiting drag&drop in backlog according to permissions
parent
54da933fe9
commit
36ec352fc5
|
@ -27,6 +27,7 @@ scopeDefer = @.taiga.scopeDefer
|
||||||
bindOnce = @.taiga.bindOnce
|
bindOnce = @.taiga.bindOnce
|
||||||
groupBy = @.taiga.groupBy
|
groupBy = @.taiga.groupBy
|
||||||
textToColor = @.taiga.textToColor
|
textToColor = @.taiga.textToColor
|
||||||
|
bindOnce = @.taiga.bindOnce
|
||||||
|
|
||||||
module = angular.module("taigaBacklog")
|
module = angular.module("taigaBacklog")
|
||||||
|
|
||||||
|
@ -707,7 +708,7 @@ UsPointsDirective = ($repo) ->
|
||||||
$repo.refresh(us).then ->
|
$repo.refresh(us).then ->
|
||||||
$ctrl.loadProjectStats()
|
$ctrl.loadProjectStats()
|
||||||
|
|
||||||
taiga.bindOnce $scope, "project", (project) ->
|
bindOnce $scope, "project", (project) ->
|
||||||
# If the user has not enough permissions the click events are unbinded
|
# If the user has not enough permissions the click events are unbinded
|
||||||
if project.my_permissions.indexOf("modify_us") == -1
|
if project.my_permissions.indexOf("modify_us") == -1
|
||||||
$el.unbind("click")
|
$el.unbind("click")
|
||||||
|
|
|
@ -46,40 +46,44 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
# helper-in-wrong-place-when-scrolled-down-page
|
# helper-in-wrong-place-when-scrolled-down-page
|
||||||
|
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
$el.sortable({
|
bindOnce $scope, "project", (project) ->
|
||||||
connectWith: ".sprint-table"
|
# If the user has not enough permissions we don't enable the sortable
|
||||||
handle: ".icon-drag-v",
|
if project.my_permissions.indexOf("modify_us") > -1
|
||||||
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) ->
|
$el.sortable({
|
||||||
itemUs = ui.item.scope().us
|
connectWith: ".sprint-table"
|
||||||
itemIndex = ui.item.index()
|
handle: ".icon-drag-v",
|
||||||
|
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
|
||||||
|
})
|
||||||
|
|
||||||
deleteElement(ui.item)
|
$el.on "sortreceive", (event, ui) ->
|
||||||
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
|
itemUs = ui.item.scope().us
|
||||||
|
itemIndex = ui.item.index()
|
||||||
|
|
||||||
$el.on "sortstop", (event, ui) ->
|
deleteElement(ui.item)
|
||||||
# When parent not exists, do nothing
|
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
|
||||||
if ui.item.parent().length == 0
|
|
||||||
return
|
|
||||||
|
|
||||||
itemUs = ui.item.scope().us
|
$el.on "sortstop", (event, ui) ->
|
||||||
itemIndex = ui.item.index()
|
# When parent not exists, do nothing
|
||||||
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
|
if ui.item.parent().length == 0
|
||||||
|
return
|
||||||
|
|
||||||
|
itemUs = ui.item.scope().us
|
||||||
|
itemIndex = ui.item.index()
|
||||||
|
$scope.$emit("sprint:us:move", itemUs, itemIndex, null)
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
@ -89,27 +93,30 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
|
|
||||||
SprintSortableDirective = ($repo, $rs, $rootscope) ->
|
SprintSortableDirective = ($repo, $rs, $rootscope) ->
|
||||||
link = ($scope, $el, $attrs) ->
|
link = ($scope, $el, $attrs) ->
|
||||||
$el.sortable({
|
bindOnce $scope, "project", (project) ->
|
||||||
dropOnEmpty: true
|
# If the user has not enough permissions we don't enable the sortable
|
||||||
connectWith: ".sprint-table,.backlog-table-body"
|
if project.my_permissions.indexOf("modify_us") > -1
|
||||||
})
|
$el.sortable({
|
||||||
|
dropOnEmpty: true
|
||||||
|
connectWith: ".sprint-table,.backlog-table-body"
|
||||||
|
})
|
||||||
|
|
||||||
$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, $scope.sprint.id)
|
$scope.$emit("sprint:us:move", itemUs, itemIndex, $scope.sprint.id)
|
||||||
|
|
||||||
$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, $scope.sprint.id)
|
$scope.$emit("sprint:us:move", itemUs, itemIndex, $scope.sprint.id)
|
||||||
|
|
||||||
return {link:link}
|
return {link:link}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue