Show a confirm message when a role is updated
parent
bad4dfeb77
commit
3b452ea279
|
@ -109,7 +109,8 @@ class RolesController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.Fil
|
||||||
@confirm.notify('error')
|
@confirm.notify('error')
|
||||||
|
|
||||||
setComputable: ->
|
setComputable: ->
|
||||||
onSuccess = null
|
onSuccess = =>
|
||||||
|
@confirm.notify("success")
|
||||||
|
|
||||||
onError = =>
|
onError = =>
|
||||||
@confirm.notify("error")
|
@confirm.notify("error")
|
||||||
|
@ -306,12 +307,15 @@ RolePermissionsDirective = ($rootscope, $repo, $confirm) ->
|
||||||
|
|
||||||
$el.on "change", ".category-item input", (event) ->
|
$el.on "change", ".category-item input", (event) ->
|
||||||
getActivePermissions = ->
|
getActivePermissions = ->
|
||||||
activePermissions = _.filter($el.find(".category-item input"), (t) -> angular.element(t).is(":checked"))
|
activePermissions = _.filter($el.find(".category-item input"), (t) ->
|
||||||
|
angular.element(t).is(":checked")
|
||||||
|
)
|
||||||
activePermissions = _.sortBy(_.map(activePermissions, (t) ->
|
activePermissions = _.sortBy(_.map(activePermissions, (t) ->
|
||||||
permission = angular.element(t).parents(".category-item").data("id")
|
permission = angular.element(t).parents(".category-item").data("id")
|
||||||
))
|
))
|
||||||
activePermissions.push("view_project")
|
activePermissions.push("view_project")
|
||||||
return activePermissions
|
return activePermissions
|
||||||
|
|
||||||
target = angular.element(event.currentTarget)
|
target = angular.element(event.currentTarget)
|
||||||
$scope.role.permissions = getActivePermissions()
|
$scope.role.permissions = getActivePermissions()
|
||||||
|
|
||||||
|
@ -320,6 +324,7 @@ RolePermissionsDirective = ($rootscope, $repo, $confirm) ->
|
||||||
categoryId = target.parents(".category-config").data("id")
|
categoryId = target.parents(".category-config").data("id")
|
||||||
renderResume(target.parents(".category-config"), categories[categoryId])
|
renderResume(target.parents(".category-config"), categories[categoryId])
|
||||||
$rootscope.$broadcast("projects:reload")
|
$rootscope.$broadcast("projects:reload")
|
||||||
|
$confirm.notify("success")
|
||||||
|
|
||||||
onError = ->
|
onError = ->
|
||||||
$confirm.notify("error")
|
$confirm.notify("error")
|
||||||
|
@ -328,7 +333,6 @@ RolePermissionsDirective = ($rootscope, $repo, $confirm) ->
|
||||||
|
|
||||||
$repo.save($scope.role).then onSuccess, onError
|
$repo.save($scope.role).then onSuccess, onError
|
||||||
|
|
||||||
|
|
||||||
$scope.$on "$destroy", ->
|
$scope.$on "$destroy", ->
|
||||||
$el.off()
|
$el.off()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue