Permission control in the buttoms
parent
ba1ba9065d
commit
20bd7a2d6b
|
@ -240,7 +240,6 @@ WatchersDirective = ($rootscope, $confirm, $tgrepo) ->
|
|||
|
||||
item = $model.$modelValue.clone()
|
||||
item.watchers = watchers
|
||||
|
||||
$model.$setViewValue(item)
|
||||
save(item)
|
||||
|
||||
|
@ -451,8 +450,7 @@ EditableSubjectDirective = ($rootscope, $tgrepo, $confirm, $navurls, $location)
|
|||
|
||||
$scope.$watch $attrs.ngModel, (item) ->
|
||||
return if not item
|
||||
scope.item = item.clone()
|
||||
scope.item.revert()
|
||||
scope.item = item
|
||||
render()
|
||||
|
||||
$scope.$on "$destroy", ->
|
||||
|
@ -516,8 +514,7 @@ EditableDescriptionDirective = ($rootscope, $tgrepo, $confirm, $navurls, $locati
|
|||
|
||||
$scope.$watch $attrs.ngModel, (item) ->
|
||||
return if not item
|
||||
scope.item = item.clone()
|
||||
scope.item.revert()
|
||||
scope.item = item
|
||||
render()
|
||||
|
||||
$scope.$on "$destroy", ->
|
||||
|
|
|
@ -482,6 +482,8 @@ UsTeamRequirementButtonDirective = ($rootscope, $tgrepo) ->
|
|||
link = ($scope, $el, $attrs, $model) ->
|
||||
render = _.once (us) ->
|
||||
$el.html(template())
|
||||
if $scope.project.my_permissions.indexOf("modify_us") == -1
|
||||
$el.find('label').css("cursor", "auto")
|
||||
|
||||
refresh = (us) ->
|
||||
if us?.team_requirement
|
||||
|
@ -498,11 +500,12 @@ UsTeamRequirementButtonDirective = ($rootscope, $tgrepo) ->
|
|||
$el.off()
|
||||
|
||||
$el.on "click", ".team-requirement", (event) ->
|
||||
us = $model.$modelValue.clone()
|
||||
us.team_requirement = not us.team_requirement
|
||||
$model.$setViewValue(us)
|
||||
$tgrepo.save($model.$modelValue).then ->
|
||||
$rootscope.$broadcast("history:reload")
|
||||
if $scope.project.my_permissions.indexOf("modify_us") != -1
|
||||
us = $model.$modelValue.clone()
|
||||
us.team_requirement = not us.team_requirement
|
||||
$model.$setViewValue(us)
|
||||
$tgrepo.save($model.$modelValue).then ->
|
||||
$rootscope.$broadcast("history:reload")
|
||||
|
||||
return {
|
||||
link: link
|
||||
|
@ -526,6 +529,8 @@ UsClientRequirementButtonDirective = ($rootscope, $tgrepo) ->
|
|||
link = ($scope, $el, $attrs, $model) ->
|
||||
render = _.once (us) ->
|
||||
$el.html(template())
|
||||
if $scope.project.my_permissions.indexOf("modify_us") == -1
|
||||
$el.find('label').css("cursor", "auto")
|
||||
|
||||
refresh = (us) ->
|
||||
if us?.client_requirement
|
||||
|
@ -542,11 +547,12 @@ UsClientRequirementButtonDirective = ($rootscope, $tgrepo) ->
|
|||
$el.off()
|
||||
|
||||
$el.on "click", ".client-requirement", (event) ->
|
||||
us = $model.$modelValue.clone()
|
||||
us.client_requirement = not us.client_requirement
|
||||
$model.$setViewValue(us)
|
||||
$tgrepo.save($model.$modelValue).then ->
|
||||
$rootscope.$broadcast("history:reload")
|
||||
if $scope.project.my_permissions.indexOf("modify_us") != -1
|
||||
us = $model.$modelValue.clone()
|
||||
us.client_requirement = not us.client_requirement
|
||||
$model.$setViewValue(us)
|
||||
$tgrepo.save($model.$modelValue).then ->
|
||||
$rootscope.$broadcast("history:reload")
|
||||
|
||||
return {
|
||||
link: link
|
||||
|
|
|
@ -52,8 +52,8 @@ block content
|
|||
section.watchers(tg-watchers, ng-model="issue")
|
||||
|
||||
section.us-detail-settings
|
||||
tg-promote-issue-to-us-button(ng-model="issue")
|
||||
div(tg-block-button, ng-model="issue")
|
||||
tg-promote-issue-to-us-button(tg-check-permission="add_us", ng-model="issue")
|
||||
div(tg-check-permission="modify_issue", tg-block-button, ng-model="issue")
|
||||
div(tg-check-permission="delete_issue", tg-delete-button,
|
||||
on-delete-go-to-url="project-issues",
|
||||
project-slug="{{ project.slug }}" ng-model="issue")
|
||||
|
|
|
@ -52,8 +52,8 @@ block content
|
|||
section.watchers(tg-watchers, ng-model="task")
|
||||
|
||||
section.us-detail-settings
|
||||
fieldset(tg-task-is-iocaine-button, ng-model="task")
|
||||
div(tg-block-button, ng-model="task")
|
||||
fieldset(tg-task-is-iocaine-button, tg-check-permission="modify_task", ng-model="task")
|
||||
div(tg-check-permission="modify_task", tg-block-button, ng-model="task")
|
||||
div(tg-check-permission="delete_task", tg-delete-button,
|
||||
on-delete-go-to-url="project-backlog",
|
||||
project-slug="{{ project.slug }}" ng-model="task")
|
||||
|
|
|
@ -60,7 +60,7 @@ block content
|
|||
section.us-detail-settings
|
||||
fieldset(tg-us-team-requirement-button, ng-model="us")
|
||||
fieldset(tg-us-client-requirement-button, ng-model="us")
|
||||
div(tg-block-button, ng-model="us")
|
||||
div(tg-check-permission="modify_us", tg-block-button, ng-model="us")
|
||||
div(tg-check-permission="delete_us", tg-delete-button,
|
||||
on-delete-go-to-url="project-backlog",
|
||||
project-slug="{{ project.slug }}" ng-model="us")
|
||||
|
|
Loading…
Reference in New Issue