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

104 lines
3.8 KiB
TypeScript
Raw Normal View History

import {Component, Input} from "@angular/core";
import {EnvProperties} from "../../../utils/properties/env-properties";
import {Author} from "../../../utils/result-preview/result-preview";
import {AlertModal} from "../../../utils/modal/alert";
@Component({
selector: 'landing-header',
template: `
[Library | new-theme]: Allow also ?pid url parameter in datasource landing | Fixes in newSearchPage for service filters. 1. dataProvider.component.ts: [Bug fix] Allow also ?pid url parameter, query accordingly and set canonicalUrl to use it in seoService and scema2jsonld. 2. dataProvider.component.html: Set canonicalUrl into URL of <schema2jsonld> | Use <landing-header> instead of <showTitle>. 3. dataProvider.service.ts: Set url for querying a datasource by pid (if ?pid in landing url param) and parse also the whole record, the objIdentifier and the relcanId. 4. landing-header.component.ts: Added @Input() isSticky: boolean = false; to set less margins when sticky. 5. resultLanding.component.html: Use <landing-header> instead of <showTitle>. 6. resultLanding.component.ts: Use renamed Identifier.getResultPIDFromIdentifiers --> Identifier.getPIDFromIdentifiers. 7. metrics.service.ts: Removed console.log. 8. searchDataproviders.service.ts: Added parsing for relcanId. 9. dataProviderInfo.ts: Added relcanId, objIdentifier, record. 10. result-preview.component.ts: Use renamed Identifier.getResultPIDFromIdentifiers --> Identifier.getPIDFromIdentifiers. 11. string-utils.class.ts: Renamed Identifier.getResultPIDFromIdentifiers --> Identifier.getPIDFromIdentifiers. 12. [SITEMAPS] extractUrlsFromSearch.ts: Use renamed Identifier.getResultPIDFromIdentifiers --> Identifier.getPIDFromIdentifiers. 13. newSearchPage.component.ts: [Bug fix] a. entityType for datasources is "dataprovider". b. Added service filter options only when entityType == "service".
2022-05-30 09:39:10 +02:00
<div class="title-section" [class.uk-margin-bottom]="!isSticky" [ngClass]="titleClass">
2022-12-20 14:27:18 +01:00
<div class="uk-margin-xsmall-bottom">
<showTitle [titleName]="title" classNames="uk-margin-remove-bottom"></showTitle>
<div *ngIf="subTitle">
<span class="uk-text-meta uk-text-small" [innerHTML]="subTitle"></span>
</div>
</div>
<div class="uk-margin-small-bottom uk-text-xsmall">
<span *ngIf="entityType" class="uk-text-capitalize uk-text-bolder" style="text-decoration: underline;">
{{entityType}}
</span>
2022-12-20 14:27:18 +01:00
<span *ngIf="types && removeUnknown(types, true).length > 0" class="uk-text-italic">
{{(entityType?' >> ':'') + removeUnknown(types, true).join(' . ')}}
</span>
<span>
<span *ngIf="startDate || endDate">
{{' . '}}
</span>
<span *ngIf="startDate && !endDate">
{{'from '}}
</span>
<span *ngIf="!startDate && endDate">
{{'until '}}
</span>
<span *ngIf="startDate">
{{startDate | date: 'yyyy'}}
</span>
<span *ngIf="startDate && endDate">
{{' - '}}
</span>
<span *ngIf="endDate">
{{endDate | date: 'yyyy'}}
</span>
</span>
<span *ngIf="status && status != ''">
{{' . ' + status}}
</span>
<span *ngIf="year && year != ''">
{{' . ' + year}}
</span>
<span *ngIf="embargoEndDate">
2022-12-20 14:27:18 +01:00
. Embargo end date: {{embargoEndDate | date: 'dd MMM yyyy'}}
</span>
<span *ngIf="underCuration">
. <span title="{{buildCurationTooltip()}}"
uk-tooltip="pos:bottom-right; delay:10;"
[Library & common-assets | new-theme]: Updates for redesign. 1. availableOn.component.ts: Updated class of title to "uk-text-light-grey" and added custom-external icon to links and updated accessright icons. 2. citation.class.ts: Added fileFormatOptions: Option[] to use it in input options. 3. citeThis.component.ts: Updated select inputs using "input" from InputComponent | Updated copy to clipboard button to link. 4. citeThis.module.ts: Import InputModule. 5. fos.component.ts: Updated class of title to "uk-text-light-grey". 6. fundedBy.component.ts: Updated class of title to "uk-text-light-grey" and updated links with uk-text-emphasis class. 7. landing-header.component.ts: Increase authorsLimit to 7 | Changed class of "under curation" to uk-text-primary (used to be custom class). 8. metrics.component.ts: Updated in clickOutside event. parsingFunctions.class.ts: Updated open, closed and unknown with icon names instead of paths to svgs (download accessright icons). 9. relatedTo.component.ts: Updated class of title to "uk-text-light-grey" and added custom-external for links. 10. resultLandingUtils.module.ts: Inport AlertModalModule (to open modal). 11. sdg.component.ts: Updated class of titlte to "uk-text-light-grey". 12. showIdentifiers.component.ts: Added view more functionality. 13. showPublisher.component.ts: Updated custon-external class. 14. resultLanding.module.ts: registerIcon link. 15. resultLanding.component.html: Updated css for result landing and commented annotations (b2note). 16. orcid-work.component.ts: Updated orcid action button for landing page. 17. orcid.module.ts: registerIcons orcid_add and orcid_bin. 18. customOptions.class.ts: [Bug fix] [By Kostis] registryOptions() was not returning properly httpHeaders. 19. showAuthors.component.ts: Updated css 20. icons.ts: Export svgs orcid_add, orcid_bin, link. 21. alert.ts: Removed margin from title. 22. result-preview.component.html: Title of results set to <h2> and uk-h6 and when links to uk-link-heading | accessRightIcon for hostedBy_collectedFrom. 23. result-preview.module.ts: Imported IconsModule. 24. landing-utils.css: Updates in landing css & css of landing-action-button & added backdrop filter missing rules. 25. utils.css: Updated class orcid-clipboard-wrapper and renamed to clipboad-wrapper | Update class .custom-external to set in content with code instead of name and updated not to underline it on hover 26. library.css: Added class .default-dropdown with max-width: 500px;
2022-04-16 09:47:30 +02:00
class="uk-text-primary">Under curation</span>
</span>
2022-12-20 14:27:18 +01:00
</div>
<div *ngIf="authors">
<showAuthors [authorsLimit]="authorLimit" [modal]="modal" [showAll]="showAllAuthors" [authors]="authors" [isSticky]="isSticky"></showAuthors>
</div>
</div>`
})
export class LandingHeaderComponent {
@Input() entityType: string;
@Input() properties: EnvProperties;
@Input() types: string[];
@Input() startDate: number; // project landing
@Input() endDate: number; // project landing
@Input() status: string; // project landing
@Input() year: string;
@Input() embargoEndDate: Date;
@Input() title: string;
@Input() subTitle: string;
@Input() authors: Author[];
[Library & common-assets | new-theme]: Updates for redesign. 1. availableOn.component.ts: Updated class of title to "uk-text-light-grey" and added custom-external icon to links and updated accessright icons. 2. citation.class.ts: Added fileFormatOptions: Option[] to use it in input options. 3. citeThis.component.ts: Updated select inputs using "input" from InputComponent | Updated copy to clipboard button to link. 4. citeThis.module.ts: Import InputModule. 5. fos.component.ts: Updated class of title to "uk-text-light-grey". 6. fundedBy.component.ts: Updated class of title to "uk-text-light-grey" and updated links with uk-text-emphasis class. 7. landing-header.component.ts: Increase authorsLimit to 7 | Changed class of "under curation" to uk-text-primary (used to be custom class). 8. metrics.component.ts: Updated in clickOutside event. parsingFunctions.class.ts: Updated open, closed and unknown with icon names instead of paths to svgs (download accessright icons). 9. relatedTo.component.ts: Updated class of title to "uk-text-light-grey" and added custom-external for links. 10. resultLandingUtils.module.ts: Inport AlertModalModule (to open modal). 11. sdg.component.ts: Updated class of titlte to "uk-text-light-grey". 12. showIdentifiers.component.ts: Added view more functionality. 13. showPublisher.component.ts: Updated custon-external class. 14. resultLanding.module.ts: registerIcon link. 15. resultLanding.component.html: Updated css for result landing and commented annotations (b2note). 16. orcid-work.component.ts: Updated orcid action button for landing page. 17. orcid.module.ts: registerIcons orcid_add and orcid_bin. 18. customOptions.class.ts: [Bug fix] [By Kostis] registryOptions() was not returning properly httpHeaders. 19. showAuthors.component.ts: Updated css 20. icons.ts: Export svgs orcid_add, orcid_bin, link. 21. alert.ts: Removed margin from title. 22. result-preview.component.html: Title of results set to <h2> and uk-h6 and when links to uk-link-heading | accessRightIcon for hostedBy_collectedFrom. 23. result-preview.module.ts: Imported IconsModule. 24. landing-utils.css: Updates in landing css & css of landing-action-button & added backdrop filter missing rules. 25. utils.css: Updated class orcid-clipboard-wrapper and renamed to clipboad-wrapper | Update class .custom-external to set in content with code instead of name and updated not to underline it on hover 26. library.css: Added class .default-dropdown with max-width: 500px;
2022-04-16 09:47:30 +02:00
@Input() authorLimit: number = 7;
@Input() showAllAuthors: boolean = true;
@Input() underCuration: boolean = false;
@Input() modal: AlertModal;
@Input() titleClass: string = null;
@Input() isTitleH1:boolean =true;
[Library | new-theme]: Allow also ?pid url parameter in datasource landing | Fixes in newSearchPage for service filters. 1. dataProvider.component.ts: [Bug fix] Allow also ?pid url parameter, query accordingly and set canonicalUrl to use it in seoService and scema2jsonld. 2. dataProvider.component.html: Set canonicalUrl into URL of <schema2jsonld> | Use <landing-header> instead of <showTitle>. 3. dataProvider.service.ts: Set url for querying a datasource by pid (if ?pid in landing url param) and parse also the whole record, the objIdentifier and the relcanId. 4. landing-header.component.ts: Added @Input() isSticky: boolean = false; to set less margins when sticky. 5. resultLanding.component.html: Use <landing-header> instead of <showTitle>. 6. resultLanding.component.ts: Use renamed Identifier.getResultPIDFromIdentifiers --> Identifier.getPIDFromIdentifiers. 7. metrics.service.ts: Removed console.log. 8. searchDataproviders.service.ts: Added parsing for relcanId. 9. dataProviderInfo.ts: Added relcanId, objIdentifier, record. 10. result-preview.component.ts: Use renamed Identifier.getResultPIDFromIdentifiers --> Identifier.getPIDFromIdentifiers. 11. string-utils.class.ts: Renamed Identifier.getResultPIDFromIdentifiers --> Identifier.getPIDFromIdentifiers. 12. [SITEMAPS] extractUrlsFromSearch.ts: Use renamed Identifier.getResultPIDFromIdentifiers --> Identifier.getPIDFromIdentifiers. 13. newSearchPage.component.ts: [Bug fix] a. entityType for datasources is "dataprovider". b. Added service filter options only when entityType == "service".
2022-05-30 09:39:10 +02:00
@Input() isSticky: boolean = false;
public removeUnknown(array: string[], type: boolean = false): string[] {
if (type) {
return this.removeDuplicates(array).filter(value => value.toLowerCase() !== 'unknown');
} else {
return array.filter(value => value.toLowerCase() !== 'unknown');
}
}
public removeDuplicates(array: string[]): string[] {
return array.filter(value => value.toLowerCase() !== this.entityType);
}
public buildCurationTooltip(): string {
let tooltipContent: string = "<div class='uk-padding-small'>";
tooltipContent += "<h5>Record in preview</h5>";
tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p>";
tooltipContent += "</div>";
return tooltipContent;
}
}