limiting drag&drop in backlog according to permissions

stable
Alejandro Alonso 2014-08-07 08:37:24 +02:00
parent 54da933fe9
commit 36ec352fc5
2 changed files with 55 additions and 47 deletions

View File

@ -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")

View File

@ -46,6 +46,10 @@ 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) ->
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
$el.sortable({ $el.sortable({
connectWith: ".sprint-table" connectWith: ".sprint-table"
handle: ".icon-drag-v", handle: ".icon-drag-v",
@ -89,6 +93,9 @@ BacklogSortableDirective = ($repo, $rs, $rootscope) ->
SprintSortableDirective = ($repo, $rs, $rootscope) -> SprintSortableDirective = ($repo, $rs, $rootscope) ->
link = ($scope, $el, $attrs) -> 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
$el.sortable({ $el.sortable({
dropOnEmpty: true dropOnEmpty: true
connectWith: ".sprint-table,.backlog-table-body" connectWith: ".sprint-table,.backlog-table-body"