openaire-library/landingPages/landing-utils/showTitle.component.ts

57 lines
2.1 KiB
TypeScript
Raw Normal View History

import {Component, ElementRef, Input, ViewChild} from '@angular/core';
@Component({
selector: 'showTitle',
template: `
<h1 [ngClass]="classNames" class="uk-h6">
<ng-container *ngTemplateOutlet="_title;"></ng-container>
</h1>
<ng-template #_title>
<div *ngIf="title != undefined" class="landingTitle uk-text-break">
<span *ngIf="title['url'] != undefined && title['url'] != null && title['url'] != ''"
class="custom-external">
<a *ngIf="title['name'] != undefined && title['name'] != ''"
href="{{title['url']}}" target="_blank"
[innerHTML]="title['name']">
</a>
<a *ngIf="title['name'] == undefined || title['name'] == ''"
href="{{title['url']}}" target="_blank">
[no title available]
</a>
</span>
<span *ngIf="(title['name'] != undefined && title['name'] != '') &&
(title['url'] == undefined || title['url'] == null || title['url'] == '')"
[innerHTML]="title['name']">
</span>
<span *ngIf="(title['name'] == undefined || title['name'] == '') &&
(title['url'] == undefined || title['url'] == null || title['url'] == '')">
[no title available]
</span>
</div>
[Library & Explore | explore-redesign]: Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph" | Fixed duplicate queries in search all | Updated paper in FoS page | Improvements in sticky tabs (search all & landing). 1. Deleted assers/explore-assets/home/graph.svg - Replaced by assets/common-assets/common/graph-nodes.svg. 2. home.component.html: a. Updated graph image. b. Added in <div search-input>: [searchInputClass]="'inner background'". c. Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph". 3. claimResultSearchForm.component.html & searchDataprovidersToDeposit.component.ts: Added in <div search-input>: [searchInputClass]="'inner background'". 4. searchAll.component.html: a. Updated margins/paddings for sticky tabs. b. Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph". 5. searchAll.component.ts: a. [Bug fix] In method ngOnInit(), moved loadAll() call inside check - avoid duplicate calls to search for each tab with count query. b. Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph". 6. fos.component.html: a. Updated paper of SciNoBo - replaced the old one with the newest. b. Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph". 7. fos.component.ts: Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph". 8. resultLanding.component.html & project.component.html & organization.component.html & dataProvider.component.html: [Improvement] Updated check and class for <landing-header> when sticky - make it invisible, when not sticky - solved flickering and change of content position. 9. showTitle.component.ts: Added @Input() isSticky: boolean = false; and when sticky, show only 1 line of the title (class lines-1). 10. landing-header.component.ts: Show only title when sticky and pass isSticky to <showTitle>.
2023-05-15 16:28:33 +02:00
<div *ngIf="titleName" #titleDiv class="uk-text-break multi-line-ellipsis" [ngClass]="isSticky ? 'lines-1' : 'lines-5'">
<span [innerHTML]="titleName" [attr.uk-tooltip]="showTitleTooltip ? 'cls: uk-active uk-width-large' : 'cls: uk-invisible'"
[title]="titleName"></span>
</div>
<div *ngIf="!titleName && !title">
<span>No title available</span>
</div>
</ng-template>
`
})
export class ShowTitleComponent {
@Input() titleName: string;
@Input() title: { [key: string]: string };
@Input() iconClass:string;
@Input() classNames: string = "";
[Library & Explore | explore-redesign]: Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph" | Fixed duplicate queries in search all | Updated paper in FoS page | Improvements in sticky tabs (search all & landing). 1. Deleted assers/explore-assets/home/graph.svg - Replaced by assets/common-assets/common/graph-nodes.svg. 2. home.component.html: a. Updated graph image. b. Added in <div search-input>: [searchInputClass]="'inner background'". c. Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph". 3. claimResultSearchForm.component.html & searchDataprovidersToDeposit.component.ts: Added in <div search-input>: [searchInputClass]="'inner background'". 4. searchAll.component.html: a. Updated margins/paddings for sticky tabs. b. Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph". 5. searchAll.component.ts: a. [Bug fix] In method ngOnInit(), moved loadAll() call inside check - avoid duplicate calls to search for each tab with count query. b. Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph". 6. fos.component.html: a. Updated paper of SciNoBo - replaced the old one with the newest. b. Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph". 7. fos.component.ts: Renamed "OpenAIRE Research Graph" to "OpenAIRE Graph". 8. resultLanding.component.html & project.component.html & organization.component.html & dataProvider.component.html: [Improvement] Updated check and class for <landing-header> when sticky - make it invisible, when not sticky - solved flickering and change of content position. 9. showTitle.component.ts: Added @Input() isSticky: boolean = false; and when sticky, show only 1 line of the title (class lines-1). 10. landing-header.component.ts: Show only title when sticky and pass isSticky to <showTitle>.
2023-05-15 16:28:33 +02:00
@Input() isSticky: boolean = false;
@ViewChild("titleDiv") titleDiv: ElementRef;
constructor () {}
get showTitleTooltip():boolean {
return !!this.titleDiv && (this.titleDiv.nativeElement.clientHeight >= 5 * 21);
}
}