Skip to content

Commit

Permalink
fix(admin-ui): Fix permission handling in nav menu
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Oct 27, 2020
1 parent cbcd21f commit 70037e5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,26 @@
<input [id]="section.id" type="checkbox" [checked]="section.collapsedByDefault" />
<label [for]="section.id">{{ section.label | translate }}</label>
<ul class="nav-list">
<li *ngFor="let item of section.items">
<a
class="nav-link"
[attr.data-item-id]="section.id"
[routerLink]="getRouterLink(item)"
routerLinkActive="active"
>
<ng-container *ngIf="item.statusBadge | async as itemBadge">
<div
*ngIf="itemBadge.type !== 'none'"
class="status-badge"
[class]="itemBadge.type"
></div>
</ng-container>
<clr-icon [attr.shape]="item.icon || 'block'" size="20"></clr-icon>
{{ item.label | translate }}
</a>
</li>
<ng-container *ngFor="let item of section.items">
<li *vdrIfPermissions="item.requiresPermission">
<a
class="nav-link"
[attr.data-item-id]="section.id"
[routerLink]="getRouterLink(item)"
routerLinkActive="active"
>
<ng-container *ngIf="item.statusBadge | async as itemBadge">
<div
*ngIf="itemBadge.type !== 'none'"
class="status-badge"
[class]="itemBadge.type"
></div>
</ng-container>
<clr-icon [attr.shape]="item.icon || 'block'" size="20"></clr-icon>
{{ item.label | translate }}
</a>
</li>
</ng-container>
</ul>
</section>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export class IfPermissionsDirective extends IfDirectiveBase<[Permission | null]>
private changeDetectorRef: ChangeDetectorRef,
) {
super(_viewContainer, templateRef, permission => {
if (!permission) {
if (permission == null) {
return of(true);
} else if (!permission) {
return of(false);
}
return this.dataService.client
Expand Down

0 comments on commit 70037e5

Please sign in to comment.