From 1e785e4fd97e17e398744a376661f353f3a8ff12 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Tue, 20 Apr 2021 15:18:15 +0000 Subject: [PATCH] [Library | Trunk]: Remove scroll to top from pages initiliazation git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60926 d315682c-612b-4755-9ff5-7f18f6832af3 --- claims/claim-utils/claimHelper.class.ts | 1 - connect/connectHelper.ts | 2 +- .../dataProvider/dataProvider.component.ts | 2 - .../landing-utils/availableOn.component.ts | 31 +------- .../landing-utils/publishedIn.component.ts | 73 ------------------- .../resultLandingUtils.module.ts | 5 +- .../organization/organization.component.ts | 5 -- landingPages/project/project.component.ts | 1 - reload/reload.component.ts | 1 - utils/authors/showAuthors.component.ts | 4 - .../svg-background.directive.ts | 35 +++++++++ utils/svg-background/svg-background.module.ts | 12 +++ utils/svg-background/svg.ts | 1 + 13 files changed, 52 insertions(+), 121 deletions(-) delete mode 100644 landingPages/landing-utils/publishedIn.component.ts create mode 100644 utils/svg-background/svg-background.directive.ts create mode 100644 utils/svg-background/svg-background.module.ts create mode 100644 utils/svg-background/svg.ts diff --git a/claims/claim-utils/claimHelper.class.ts b/claims/claim-utils/claimHelper.class.ts index c3dd8e73..a2630379 100644 --- a/claims/claim-utils/claimHelper.class.ts +++ b/claims/claim-utils/claimHelper.class.ts @@ -158,7 +158,6 @@ export class ShowOptions { this.basketShowLinksTo = false; this.basketShowSources = true; HelperFunctions.scroll(); - } showLinkTo() { diff --git a/connect/connectHelper.ts b/connect/connectHelper.ts index 0e0aaeee..c66911d1 100644 --- a/connect/connectHelper.ts +++ b/connect/connectHelper.ts @@ -5,7 +5,7 @@ export class ConnectHelper { public static getCommunityFromDomain(domain: string): string{ if(properties.environment == "development") { - domain = "beta.enermaps.openaire.eu"; //for testing + domain = "beta.egi.openaire.eu"; //for testing } domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix if (domain.indexOf('openaire.eu') === -1) { diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index c2330f64..a2f370ae 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -161,8 +161,6 @@ export class DataProviderComponent { } }); } - - HelperFunctions.scroll(); })); } diff --git a/landingPages/landing-utils/availableOn.component.ts b/landingPages/landing-utils/availableOn.component.ts index b3b6aaa3..1f6baea0 100644 --- a/landingPages/landing-utils/availableOn.component.ts +++ b/landingPages/landing-utils/availableOn.component.ts @@ -54,7 +54,6 @@ import {properties} from "../../../../environments/environment"; -
View more @@ -70,15 +69,6 @@ import {properties} from "../../../../environments/environment"; export class AvailableOnComponent { @Input() availableOn: HostedByCollectedFrom[]; - // { - // "downloadName": string, "downloadUrl": string[], - // "collectedName": string, "collectedId": string, - // "accessMode": string[], "bestAccessMode": string, - // "type": string, "year": string, icon: string - // }[]; - // public open = 'assets/common-assets/unlock.svg'; - // public closed = 'assets/common-assets/lock.svg'; - // public unknown = 'assets/common-assets/question.svg'; public threshold: number = 4; public showNum: number = 4; public dataProviderUrl = properties.searchLinkToDataProvider.split('?')[0]; @@ -86,22 +76,7 @@ export class AvailableOnComponent { constructor() { } - ngOnInit() { - // this.availableOn.forEach(available => { - // if (available.bestAccessMode) { - // if (available.bestAccessMode.toLowerCase().indexOf('open') !== -1) { - // available.icon = this.open; - // } else if (available.bestAccessMode.toLowerCase().indexOf('not available') !== -1) { - // available.icon = this.unknown; - // } else { - // available.icon = this.closed; - // } - // } else { - // available.icon = this.unknown; - // } - // } - // ); - } + ngOnInit() {} public removeUnknown(value: string): string { if (value.toLowerCase() === 'unknown') { @@ -109,8 +84,4 @@ export class AvailableOnComponent { } return value; } - - public scroll() { - HelperFunctions.scroll(); - } } diff --git a/landingPages/landing-utils/publishedIn.component.ts b/landingPages/landing-utils/publishedIn.component.ts deleted file mode 100644 index ec4fe355..00000000 --- a/landingPages/landing-utils/publishedIn.component.ts +++ /dev/null @@ -1,73 +0,0 @@ -import {Component, Input} from '@angular/core'; -import {HelperFunctions} from "../../utils/HelperFunctions.class"; - -// NOT USED -@Component({ - selector: 'publishedIn', - template: ` -
-
Published in
-
- -
-
- - View less - -
- -
- - View more - -
-
- ` - }) - -// NOT USED -export class PublishedInComponent { - public threshold: number = 5; - public showNum: number = 5; - - //key is name - @Input() publishedIn: Map; - - public showAll: boolean = false; - - constructor () {} - - ngOnInit() {} - - public scroll() { - HelperFunctions.scroll(); - } - public getKeys( map) { - return Array.from(map.keys()); - } -} diff --git a/landingPages/landing-utils/resultLandingUtils.module.ts b/landingPages/landing-utils/resultLandingUtils.module.ts index 036a76a8..3391ea86 100644 --- a/landingPages/landing-utils/resultLandingUtils.module.ts +++ b/landingPages/landing-utils/resultLandingUtils.module.ts @@ -7,7 +7,6 @@ import {PagingModule} from '../../utils/paging.module'; import {ShowIdentifiersComponent} from './showIdentifiers.component'; import {ShowSubjectsComponent} from './showSubjects.component'; import {FundedByComponent} from './fundedBy.component'; -import {PublishedInComponent} from './publishedIn.component'; import {AvailableOnComponent} from './availableOn.component'; import {TabTableComponent} from './tabTable.component'; import {ShowPublisherComponent} from "./showPublisher.component"; @@ -21,14 +20,14 @@ import {RelatedToComponent} from "./relatedTo.component"; ], declarations: [ ShowIdentifiersComponent,ShowSubjectsComponent, - FundedByComponent,PublishedInComponent,AvailableOnComponent,TabTableComponent, + FundedByComponent,AvailableOnComponent,TabTableComponent, RelatedToComponent ], providers:[ ], exports: [ ShowIdentifiersComponent, ShowSubjectsComponent, - FundedByComponent, PublishedInComponent, AvailableOnComponent, TabTableComponent, ShowPublisherComponent, + FundedByComponent,AvailableOnComponent, TabTableComponent, ShowPublisherComponent, RelatedToComponent ] }) diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index f16c7166..a1cc6bc2 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -156,13 +156,8 @@ export class OrganizationComponent { "page_type": "organization" } }); - //this.warningMessage = "No valid organization id"; } - - HelperFunctions.scroll(); - this.csvParamsTail = '" and relorganizationid exact "' + this.organizationId + '" ))'; - })); this.downloadURLAPI = this.properties.csvAPIURL; diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index 9828cc91..b625c6ec 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -189,7 +189,6 @@ export class ProjectComponent { this.downloadURLAPI = this.properties.csvAPIURL; this.createClipboard(); - HelperFunctions.scroll(); })); } diff --git a/reload/reload.component.ts b/reload/reload.component.ts index d842d1f2..e86df79c 100644 --- a/reload/reload.component.ts +++ b/reload/reload.component.ts @@ -15,7 +15,6 @@ export class ReloadComponent { } public ngOnInit() { - HelperFunctions.scroll(); let URL = Session.getReloadUrl(); if (URL && URL["path"] && URL["path"] != "") { let url: string = URL["path"]; diff --git a/utils/authors/showAuthors.component.ts b/utils/authors/showAuthors.component.ts index ea3a5196..f4bc0b01 100644 --- a/utils/authors/showAuthors.component.ts +++ b/utils/authors/showAuthors.component.ts @@ -114,10 +114,6 @@ export class ShowAuthorsComponent { } } - public scroll() { - HelperFunctions.scroll(); - } - public onClick() { if (this.modal) { this.modal.cancel(); diff --git a/utils/svg-background/svg-background.directive.ts b/utils/svg-background/svg-background.directive.ts new file mode 100644 index 00000000..32b50b5d --- /dev/null +++ b/utils/svg-background/svg-background.directive.ts @@ -0,0 +1,35 @@ +import {Directive, ElementRef, Input, OnInit, Renderer2} from "@angular/core"; + +@Directive({ + selector: '[svg-background]', +}) +export class SvgBackgroundDirective implements OnInit{ + @Input() + private color: string; + @Input() + private svg: string; + @Input() + private svgColor: string; + @Input() + private position: string = null; + private readonly element: any; + + constructor(private elementRef: ElementRef, + private renderer: Renderer2,) { + this.element = this.elementRef.nativeElement; + } + + ngOnInit() { + let svg = this.encodeSvg(); + if(this.position && svg) { + this.renderer.setStyle(this.element, 'background', "url(" + svg + ") " + (this.color?this.color + " ":"") + "no-repeat " + this.position); + } + } + + private encodeSvg(): string { + if(this.svg && this.svgColor) { + return 'data:image/svg+xml,' + encodeURIComponent(this.svg.replace('{{color}}', this.svgColor)); + } + return null; + } +} diff --git a/utils/svg-background/svg-background.module.ts b/utils/svg-background/svg-background.module.ts new file mode 100644 index 00000000..7732d9a2 --- /dev/null +++ b/utils/svg-background/svg-background.module.ts @@ -0,0 +1,12 @@ +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; +import {SvgBackgroundDirective} from "./svg-background.directive"; + +@NgModule({ + imports: [CommonModule], + declarations: [SvgBackgroundDirective], + exports: [SvgBackgroundDirective] +}) +export class SvgBackgroundModule { + +} diff --git a/utils/svg-background/svg.ts b/utils/svg-background/svg.ts new file mode 100644 index 00000000..b210b8cd --- /dev/null +++ b/utils/svg-background/svg.ts @@ -0,0 +1 @@ +export const search = 'Asset 3'