Skip to content

Commit 8abe295

Browse files
committed
add anonymous menu
1 parent 79540ca commit 8abe295

File tree

5 files changed

+26
-3
lines changed

5 files changed

+26
-3
lines changed

projects/fusio-sdk/src/lib/component/bootstrap/bootstrap.component.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
<div ngbDropdown class="fusio-header-profile" *ngIf="user">
99
<button type="button" class="btn" id="userMenu" ngbDropdownToggle>{{ user.name }} <i class="bi bi-person"></i></button>
1010
<div ngbDropdownMenu aria-labelledby="userMenu">
11-
<button ngbDropdownItem routerLink="{{ item.path }}" *ngFor="let item of menu">{{ item.title }}</button>
11+
<button ngbDropdownItem routerLink="{{ item.path }}" *ngFor="let item of userMenu">{{ item.title }}</button>
12+
</div>
13+
</div>
14+
<div ngbDropdown class="fusio-header-profile" *ngIf="!user">
15+
<button type="button" class="btn" id="anonymousMenu" ngbDropdownToggle>Anonymous <i class="bi bi-person"></i></button>
16+
<div ngbDropdownMenu aria-labelledby="anonymousMenu">
17+
<button ngbDropdownItem routerLink="{{ item.path }}" *ngFor="let item of anonymousMenu">{{ item.title }}</button>
1218
</div>
1319
</div>
1420
<div class="fusio-content">

projects/fusio-sdk/src/lib/component/bootstrap/bootstrap.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import {Item, NavigationService} from "../../service/navigation.service";
1010
})
1111
export class BootstrapComponent implements OnInit {
1212
user?: User;
13-
menu: Array<Item> = [];
13+
userMenu: Array<Item> = [];
14+
anonymousMenu: Array<Item> = [];
1415

1516
constructor(private userMeta: UserService, private navigation: NavigationService) { }
1617

1718
ngOnInit(): void {
1819
this.user = this.userMeta.get();
19-
this.menu = this.navigation.getUserNavigation();
20+
this.userMenu = this.navigation.getUserNavigation();
21+
this.anonymousMenu = this.navigation.getAnonymousNavigation();
2022
}
2123

2224
}

projects/fusio-sdk/src/lib/config/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface Config {
1414
loginPath?: string,
1515
navigation?: Array<GroupItem>,
1616
userNavigation?: Array<Item>,
17+
anonymousNavigation?: Array<Item>,
1718
accountNavigation?: Array<Item>,
1819
paymentProvider?: string,
1920
paymentCurrency?: string,

projects/fusio-sdk/src/lib/service/config.service.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ export class ConfigService {
6363
}];
6464
}
6565

66+
public getAnonymousNavigation(): Array<Item> {
67+
return this.config.anonymousNavigation || [{
68+
title: 'Login',
69+
path: '/login'
70+
}, {
71+
title: 'Register',
72+
path: '/register',
73+
}];
74+
}
75+
6676
public getAccountNavigation(): Array<Item> {
6777
return this.config.accountNavigation || [{
6878
title: 'Account',

projects/fusio-sdk/src/lib/service/navigation.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ export class NavigationService {
1818
return this.checkPermissionsItems(this.config.getUserNavigation());
1919
}
2020

21+
getAnonymousNavigation(): Array<Item> {
22+
return this.config.getAnonymousNavigation();
23+
}
24+
2125
getAccountNavigation(): Array<Item> {
2226
return this.checkPermissionsItems(this.config.getAccountNavigation());
2327
}

0 commit comments

Comments
 (0)