Merge pull request #399 from taigaio/backlog-broken-for-annonymus-users
Backlog broken for annonymus usersstable
commit
c59f523ce7
|
@ -60,6 +60,42 @@ CheckPermissionDirective = ->
|
|||
|
||||
module.directive("tgCheckPermission", CheckPermissionDirective)
|
||||
|
||||
#############################################################################
|
||||
## Add class based on permissions
|
||||
#############################################################################
|
||||
|
||||
ClassPermissionDirective = ->
|
||||
name = "tgClassPermission"
|
||||
|
||||
link = ($scope, $el, $attrs) ->
|
||||
checkPermissions = (project, className, permission) ->
|
||||
negation = permission[0] == "!"
|
||||
|
||||
permission = permission.slice(1) if negation
|
||||
|
||||
if negation && project.my_permissions.indexOf(permission) == -1
|
||||
$el.addClass(className)
|
||||
else if project.my_permissions.indexOf(permission) != -1
|
||||
$el.addClass(className)
|
||||
else
|
||||
$el.removeClass(className)
|
||||
|
||||
tgClassPermissionWatchAction = (project) ->
|
||||
if project
|
||||
unbindWatcher()
|
||||
|
||||
classes = $scope.$eval($attrs[name])
|
||||
|
||||
for className, permission of classes
|
||||
checkPermissions(project, className, permission)
|
||||
|
||||
|
||||
unbindWatcher = $scope.$watch "project", tgClassPermissionWatchAction
|
||||
|
||||
return {link:link}
|
||||
|
||||
module.directive("tgClassPermission", ClassPermissionDirective)
|
||||
|
||||
#############################################################################
|
||||
## Animation frame service, apply css changes in the next render frame
|
||||
#############################################################################
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
div.row.us-item-row(ng-repeat="us in visibleUserstories track by us.id", tg-bind-scope, ng-class="{blocked: us.is_blocked}")
|
||||
div.row.us-item-row(ng-repeat="us in visibleUserstories track by us.id", tg-bind-scope, ng-class="{blocked: us.is_blocked}", tg-class-permission="{'readonly': '!modify_us'}")
|
||||
div.user-stories
|
||||
div.tags-block(tg-colorize-tags="us.tags", tg-colorize-tags-type="backlog")
|
||||
div.user-story-name
|
||||
|
|
|
@ -237,4 +237,8 @@
|
|||
opacity: 0;
|
||||
padding: .1rem .5rem 0 0;
|
||||
}
|
||||
.readonly {
|
||||
cursor: auto;
|
||||
padding-right: 45px;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue