add featured menu items in the nav bar - dev only

This commit is contained in:
Alex Martzios 2022-03-02 12:27:48 +02:00
parent a2a34d3958
commit 5e92fdf83b
2 changed files with 40 additions and 4 deletions

View File

@ -247,8 +247,9 @@
</li> </li>
</ng-container> </ng-container>
<!-- Custom menu items --> <!-- Custom menu items -->
<ng-container *ngIf="customMenuItems?.length > 0 && properties.environment == 'development'"> <!-- TODO: Add to mobile menu as well! -->
<ng-container *ngFor="let menu of customMenuItems"> <ng-container *ngIf="additionalMenuItems?.length > 0 && properties.environment == 'development'">
<ng-container *ngFor="let menu of additionalMenuItems">
<li class="uk-parent"> <li class="uk-parent">
<!-- INTERNAL ROOT--> <!-- INTERNAL ROOT-->
<a *ngIf="menu.type == 'internal' && menu.route && isEnabled([menu.route], showPage)" routerLinkActive="uk-link" <a *ngIf="menu.type == 'internal' && menu.route && isEnabled([menu.route], showPage)" routerLinkActive="uk-link"
@ -310,6 +311,31 @@
</nav> </nav>
</div> </div>
</div> </div>
<!-- New navbar for featured menu items - test only -->
<ng-container *ngIf="featuredMenuItems?.length > 0 && properties.environment == 'development'">
<div class="featuredNavBar">
<ul>
<ng-container *ngFor="let item of featuredMenuItems">
<li>
<!-- INTERNAL -->
<a *ngIf="item.type == 'internal' && item.route && isEnabled([item.route], showPage)" routerLinkActive="uk-link"
routerLink="{{item.route}}"
[queryParams]="item.params"
[fragment]="item.fragment"
[class.uk-active]="isTheActiveMenuItem(item)">
{{item.title}}
</a>
<!-- EXTERNAL -->
<a *ngIf="item.type == 'external' && item.url" routerLinkActive="uk-link"
href="{{item.url}}"
target="_blank">
{{item.title}}
</a>
</li>
</ng-container>
</ul>
</div>
</ng-container>
</div> </div>
<div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical"> <div class="first_page_section uk-section-default uk-section uk-padding-remove-vertical">

View File

@ -51,7 +51,8 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
showPage = {}; showPage = {};
specialAnnouncementContent: string = null; specialAnnouncementContent: string = null;
public customMenuItems: MenuItem[] = []; public additionalMenuItems: MenuItem[] = [];
public featuredMenuItems: MenuItem[] = [];
constructor(private router: Router, constructor(private router: Router,
private route: ActivatedRoute, private route: ActivatedRoute,
@ -109,7 +110,16 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
this.subs.push( this.subs.push(
this._helpContentService.getMenuItems(this.portal).subscribe( this._helpContentService.getMenuItems(this.portal).subscribe(
data => { data => {
this.customMenuItems = data; // Will divide all the custom menu items into 2 arrays.
// One for the extra(added next to the hardcoded menu items in the existing nav bar) - additionalMenuItems
// One for the featured(new nav bar below the existing one) - featuredMenuItems
data.forEach(menuItem => {
if(menuItem.isFeatured) {
this.featuredMenuItems.push(menuItem);
} else {
this.additionalMenuItems.push(menuItem);
}
});
}, },
error => this.handleError("Server error fetching custom menu items", error) error => this.handleError("Server error fetching custom menu items", error)
) )