[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";
This commit is contained in:
Konstantina Galouni 2022-06-29 13:56:19 +03:00
parent 9b5607fbd0
commit bbbb711865
4 changed files with 19 additions and 12 deletions

View File

@ -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(<MenuItem>this.menuItemForm.value, this.portal).subscribe(
menuItem => {

View File

@ -41,7 +41,7 @@ import {properties} from "../../../../environments/environment";
<div *ngIf="instance.license" class="uk-text-meta uk-text-truncate" uk-tooltip [title]="instance.license">
License:
<a *ngIf="isUrl(instance.license); else elseBlock"
[href]="instance.license" target="_blank" class="custom-external">
[href]="instance.license" target="_blank" class="custom-external uk-link-text">
{{instance.license}}
</a>
<ng-template #elseBlock> {{instance.license}}</ng-template>
@ -49,7 +49,7 @@ import {properties} from "../../../../environments/environment";
<div *ngIf="instance.collectedNamesAndIds?.size > 0" class="uk-text-meta">
<span>Providers: </span>
<a *ngFor="let collectedName of getKeys(instance.collectedNamesAndIds); let i=index" [routerLink]="dataProviderUrl"
[queryParams]="{datasourceId: instance.collectedNamesAndIds.get(collectedName)}">
[queryParams]="{datasourceId: instance.collectedNamesAndIds.get(collectedName)}" class="uk-link-text">
{{collectedName}}<ng-container *ngIf="(i !== (instance.collectedNamesAndIds.size - 1))">; </ng-container>
</a>
</div>

View File

@ -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 {

View File

@ -45,8 +45,8 @@
[queryParams]="menu.rootItem.params"
[fragment]="menu.rootItem.fragment">{{menu.rootItem.title}}</a>
<a *ngIf="menu.rootItem.route.length == 0 && menu.rootItem.url.length > 0"
href="{{menu.rootItem.url}}" (click)="closeCanvas(canvas)" [class.custom-external]="menu.rootItem.url.includes('http')"
target="{{menu.rootItem.url.includes('http') ? '_blank' : '_self'}}">{{menu.rootItem.title}}</a>
href="{{menu.rootItem.url}}" (click)="closeCanvas(canvas)" [class.custom-external]="menu.rootItem.target != '_self'"
target="{{menu.rootItem.target}}">{{menu.rootItem.title}}</a>
<a *ngIf="(menu.rootItem.route.length == 0 && menu.rootItem.url.length == 0) ||
(menu.rootItem.route.length >0 && menu.rootItem.routeRequired && !isEnabled([menu.rootItem.route], showPage)
&& isAtleastOneEnabled(menu.rootItem.routeRequired, showPage))"
@ -60,8 +60,8 @@
routerLink="{{submenu.route}}" [queryParams]=submenu.params
[fragment]="submenu.fragment">{{submenu.title}}</a>
<a *ngIf="submenu.route.length == 0 && submenu.url.length > 0"
href="{{submenu.url}}" (click)="closeCanvas(canvas)" [class.custom-external]="submenu.url.includes('http')"
target="{{submenu.url.includes('http') ? '_blank' : '_self'}}">{{submenu.title}}</a>
href="{{submenu.url}}" (click)="closeCanvas(canvas)" [class.custom-external]="submenu.target != '_self'"
target="{{submenu.target}}">{{submenu.title}}</a>
<ul *ngIf="submenu.items && submenu.items.length > 0" class="uk-nav-sub">
<ng-container *ngFor="let subsubmenu of submenu.items">
<li>
@ -140,8 +140,8 @@
[queryParams]="menu.rootItem.params"
[fragment]="menu.rootItem.fragment"> {{menu.rootItem.title}}</a>
<a *ngIf="menu.rootItem.route.length == 0 && menu.rootItem.url.length > 0"
href="{{menu.rootItem.url}}" target="{{menu.rootItem.url.includes('http') ? '_blank' : '_self'}}"
[class.custom-external]="menu.rootItem.url.includes('http')">{{menu.rootItem.title}}</a>
href="{{menu.rootItem.url}}" target="{{menu.rootItem.target}}"
[class.custom-external]="menu.rootItem.target != '_self'">{{menu.rootItem.title}}</a>
<a *ngIf="(menu.rootItem.route.length == 0 && menu.rootItem.url.length == 0) || ( menu.rootItem.route.length >0 && menu.rootItem.routeRequired && !isEnabled([menu.rootItem.route], showPage) && isAtleastOneEnabled(menu.rootItem.routeRequired, showPage))">{{menu.rootItem.title}}</a>
<div *ngIf="menu.items.length > 0" class="uk-navbar-dropdown uk-navbar-dropdown-bottom-left">
<div class="uk-height-max-medium uk-overflow-auto">
@ -155,8 +155,8 @@
routerLink="{{submenu.route}}" [queryParams]="submenu.params"
[fragment]="submenu.fragment">{{submenu.title}}</a>
<a *ngIf="submenu.route.length == 0 && submenu.url.length > 0"
href="{{submenu.url}}" [class.custom-external]="submenu.url.includes('http')"
target="{{submenu.url.includes('http') ? '_blank' : '_self'}}">{{submenu.title}}</a>
href="{{submenu.url}}" [class.custom-external]="submenu.target != '_self'"
target="{{submenu.target}}">{{submenu.title}}</a>
<ul *ngIf="submenu.items && submenu.items.length > 0" class="uk-nav-sub">
<ng-container *ngFor="let subsubmenu of submenu.items">
<li>