From a2a34d3958f2fd2c5e9a9d596453b226a78e8dba Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Wed, 2 Mar 2022 12:26:28 +0200 Subject: [PATCH 1/3] add featured menu item functionality - admin --- dashboard/menu/menu.component.html | 16 +++++++++++++--- dashboard/menu/menu.component.ts | 10 ++++++++-- sharedComponents/menu.ts | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/dashboard/menu/menu.component.html b/dashboard/menu/menu.component.html index fbc71e1e..7ce22cb9 100644 --- a/dashboard/menu/menu.component.html +++ b/dashboard/menu/menu.component.html @@ -39,7 +39,7 @@ -
-
No menu items found
+
+
+
Featured menu items can't have any sub menu items
@@ -118,8 +122,14 @@
+
+
Featured
+ + +
+ [options]="getTypeOptions(menuItemForm.get('isFeatured').value)" [tooltip]="false">
diff --git a/dashboard/menu/menu.component.ts b/dashboard/menu/menu.component.ts index cdedb37e..b18bec0e 100644 --- a/dashboard/menu/menu.component.ts +++ b/dashboard/menu/menu.component.ts @@ -132,11 +132,15 @@ export class MenuComponent implements OnInit { ); } - getTypeOptions() { + getTypeOptions(isFeatured: boolean = false) { if(this.isChild) { return this.typeOptions; } else { - return this.typeOptions.concat(this.rootOnlyTypeOptions); + if(isFeatured) { + return this.typeOptions; + } else { + return this.typeOptions.concat(this.rootOnlyTypeOptions); + } } } @@ -247,6 +251,7 @@ export class MenuComponent implements OnInit { route: this._fb.control(""), url: this._fb.control(""), isEnabled: this._fb.control(""), + isFeatured: this._fb.control(false), parentItemId: this._fb.control(isChild ? this.activeRootMenuId : null) }); this.isChild = isChild; @@ -261,6 +266,7 @@ export class MenuComponent implements OnInit { type: this._fb.control(menuItem['type'],Validators.required), route: this._fb.control(menuItem.route, (menuItem['type'] == "internal") ? [Validators.required] : []), url: this._fb.control(menuItem.url, (menuItem['type'] == "external") ? [Validators.required, StringUtils.urlValidator()] : []), + isFeatured: this._fb.control(menuItem.isFeatured), parentItemId: this._fb.control(menuItem['parentItemId']) }); this.isChild = isChild; diff --git a/sharedComponents/menu.ts b/sharedComponents/menu.ts index 6e646186..7cf36b96 100644 --- a/sharedComponents/menu.ts +++ b/sharedComponents/menu.ts @@ -15,6 +15,7 @@ export class MenuItem { icon: string; open: boolean; customClass: string = null; + isFeatured: boolean; constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params, icon=null, fragment = null, customClass = null, routeActive = null) { this._id = id; From 5e92fdf83bbdff652743f9c73be574023483be1f Mon Sep 17 00:00:00 2001 From: Alex Martzios Date: Wed, 2 Mar 2022 12:27:48 +0200 Subject: [PATCH 2/3] add featured menu items in the nav bar - dev only --- sharedComponents/navigationBar.component.html | 30 +++++++++++++++++-- sharedComponents/navigationBar.component.ts | 14 +++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index 893bb754..9375da32 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -247,8 +247,9 @@ - - + + +
  • + + + +
    diff --git a/sharedComponents/navigationBar.component.ts b/sharedComponents/navigationBar.component.ts index be35cb3e..7dc6406c 100644 --- a/sharedComponents/navigationBar.component.ts +++ b/sharedComponents/navigationBar.component.ts @@ -51,7 +51,8 @@ export class NavigationBarComponent implements OnInit, OnDestroy { showPage = {}; specialAnnouncementContent: string = null; - public customMenuItems: MenuItem[] = []; + public additionalMenuItems: MenuItem[] = []; + public featuredMenuItems: MenuItem[] = []; constructor(private router: Router, private route: ActivatedRoute, @@ -109,7 +110,16 @@ export class NavigationBarComponent implements OnInit, OnDestroy { this.subs.push( this._helpContentService.getMenuItems(this.portal).subscribe( 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) ) From 476ce764f0d71981850799a96bc92e2c117d2feb Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Thu, 3 Mar 2022 12:40:14 +0200 Subject: [PATCH 3/3] Modal change checkbox selection to true by default --- utils/modal/alert.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/modal/alert.ts b/utils/modal/alert.ts index 4cfcad6f..ba2fb884 100644 --- a/utils/modal/alert.ts +++ b/utils/modal/alert.ts @@ -120,7 +120,7 @@ export class AlertModal { /** * Value will be emitted if @choice is true */ - public select: boolean = false; + public select: boolean = true; /** * Emitted when a ok button was clicked * or when Ok method is called.