From bbbb7118654014845d71fd90e6545c6c3338c25f Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Wed, 29 Jun 2022 13:56:19 +0300 Subject: [PATCH] [Library | new-theme]: Bug fix in download from of result landing links | In menu items added "target" field to define if urls open in new tab and have external icon. 1. availableOn.component.ts: [Bug fix] Added class "uk-link-text" in links of license and providers. 2. menu.ts: In MenuItem added field target: string = "_blank"; and in constructor added parameters and initialization of target, type, isFeatured. 3. navigationBar.component.html: Updated checks for "custom-external" class and target according to target field of MenuItem. 4. app.component.ts: In "Manage" menu item set target to "_self". 5. menu.component.ts: (Admin form) In method "menuItemSaveConfirmed()" added: this.menuItemForm.value.target = this.menuItemForm.value['type'] == "internal" ? "_self" : "_blank"; --- dashboard/menu/menu.component.ts | 3 ++- .../landing-utils/availableOn.component.ts | 4 ++-- sharedComponents/menu.ts | 8 +++++++- sharedComponents/navigationBar.component.html | 16 ++++++++-------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/dashboard/menu/menu.component.ts b/dashboard/menu/menu.component.ts index eaf0da8a..7e0159e2 100644 --- a/dashboard/menu/menu.component.ts +++ b/dashboard/menu/menu.component.ts @@ -330,7 +330,8 @@ export class MenuComponent implements OnInit { public menuItemSaveConfirmed(data: any) { this.destroyTypeSubscription(); this.showLoading = true; - if(!this.menuItemForm.value._id) { + this.menuItemForm.value.target = this.menuItemForm.value['type'] == "internal" ? "_self" : "_blank"; + if(!this.menuItemForm.value._id) { this.subscriptions.push( this._helpContentService.saveMenuItem(this.menuItemForm.value, this.portal).subscribe( menuItem => { diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index fc4bcce2..48536226 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -41,7 +41,7 @@ import {properties} from "../../../../environments/environment";
License: + [href]="instance.license" target="_blank" class="custom-external uk-link-text"> {{instance.license}} {{instance.license}} @@ -49,7 +49,7 @@ import {properties} from "../../../../environments/environment"; diff --git a/sharedComponents/menu.ts b/sharedComponents/menu.ts index 18040a8f..a6b7cb8e 100644 --- a/sharedComponents/menu.ts +++ b/sharedComponents/menu.ts @@ -21,8 +21,11 @@ export class MenuItem { open: boolean; customClass: string = null; isFeatured: boolean; + target: string = "_blank"; - constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], routeRequired: string[], params, icon: Icon = null, fragment = null, customClass = null, routeActive = null) { + constructor(id: string, title: string, url: string, route: string, needsAuthorization: boolean, entitiesRequired: string[], + routeRequired: string[], params, icon: Icon = null, fragment = null, customClass = null, routeActive = null, + target: string = "_blank", type: string = "internal", isFeatured: boolean = false) { this._id = id; this.title = title; this.url = url; @@ -36,6 +39,9 @@ export class MenuItem { this.icon = icon; this.fragment = fragment; this.customClass = customClass; + this.target = target; + this.type = type; + this.isFeatured = isFeatured; } public static isTheActiveMenu(menu: MenuItem, currentRoute: any, activeMenuItem: string=""): boolean { diff --git a/sharedComponents/navigationBar.component.html b/sharedComponents/navigationBar.component.html index 30fea9e8..0e9eccb6 100644 --- a/sharedComponents/navigationBar.component.html +++ b/sharedComponents/navigationBar.component.html @@ -45,8 +45,8 @@ [queryParams]="menu.rootItem.params" [fragment]="menu.rootItem.fragment">{{menu.rootItem.title}} {{menu.rootItem.title}} + href="{{menu.rootItem.url}}" (click)="closeCanvas(canvas)" [class.custom-external]="menu.rootItem.target != '_self'" + target="{{menu.rootItem.target}}">{{menu.rootItem.title}} {{submenu.title}} {{submenu.title}} + href="{{submenu.url}}" (click)="closeCanvas(canvas)" [class.custom-external]="submenu.target != '_self'" + target="{{submenu.target}}">{{submenu.title}}
  • @@ -140,8 +140,8 @@ [queryParams]="menu.rootItem.params" [fragment]="menu.rootItem.fragment"> {{menu.rootItem.title}} {{menu.rootItem.title}} + href="{{menu.rootItem.url}}" target="{{menu.rootItem.target}}" + [class.custom-external]="menu.rootItem.target != '_self'">{{menu.rootItem.title}} {{menu.rootItem.title}}
    @@ -155,8 +155,8 @@ routerLink="{{submenu.route}}" [queryParams]="submenu.params" [fragment]="submenu.fragment">{{submenu.title}} {{submenu.title}} + href="{{submenu.url}}" [class.custom-external]="submenu.target != '_self'" + target="{{submenu.target}}">{{submenu.title}}