[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-7f18f6832af3deprecated-master
parent
9e96ecddc6
commit
1e785e4fd9
@ -1,73 +0,0 @@
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
||||
|
||||
// NOT USED
|
||||
@Component({
|
||||
selector: 'publishedIn',
|
||||
template: `
|
||||
<dl [class]="'uk-description-list-line' + ((publishedIn && publishedIn.size > threshold) ? ' uk-margin-remove-bottom' : '')">
|
||||
<dt class="title">Published in</dt>
|
||||
<dd class="line" *ngFor="let key of getKeys(publishedIn) let i=index">
|
||||
<div *ngIf="i<5 || showAll" class="{{publishedIn.get(key)['bestAccessMode']}}">
|
||||
<span [class]="publishedIn.get(key)['url'].length > 0 ? 'custom-external custom-icon' : ''">
|
||||
<span *ngIf="publishedIn.get(key)['url'].length > 1">
|
||||
{{key}}
|
||||
<span *ngFor="let url of publishedIn.get(key)['url']; let i=index">
|
||||
<a href="{{url}}" target="_blank"
|
||||
[attr.uk-tooltip]="publishedIn.get(key)['accessMode'][i] ? 'pos:right; delay:10' : 'cls: uk-invisible'"
|
||||
[title]="publishedIn.get(key)['accessMode'][i]">
|
||||
[{{i+1}}]
|
||||
</a>
|
||||
</span>
|
||||
</span>
|
||||
<a *ngIf="publishedIn.get(key)['url'].length == 1"
|
||||
href="{{publishedIn.get(key)['url']}}"
|
||||
target="_blank"
|
||||
[attr.uk-tooltip]="publishedIn.get(key)['bestAccessMode'] ? 'pos:right; delay:10' : 'cls: uk-invisible'"
|
||||
[title]="publishedIn.get(key)['bestAccessMode']">
|
||||
{{key}}
|
||||
</a>
|
||||
<span *ngIf="publishedIn.get(key)['url'].length == 0"
|
||||
[attr.uk-tooltip]="publishedIn.get(key)['bestAccessMode'] ? 'pos:right; delay:10' : 'cls: uk-invisible'"
|
||||
[title]="publishedIn.get(key)['bestAccessMode']">
|
||||
{{key}}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</dd>
|
||||
<dd *ngIf="showAll" class="uk-text-right uk-margin-bottom">
|
||||
<a class="uk-text-muted" (click)="showAll = !showAll; scroll()">
|
||||
View less
|
||||
</a>
|
||||
</dd>
|
||||
<!-- <dd *ngIf="!showAll && publishedIn.size > 5">...</dd>-->
|
||||
<dd *ngIf="!showAll && publishedIn.size > 5" class="uk-text-right uk-margin-bottom">
|
||||
<a class="uk-text-muted" (click)="showAll = !showAll;">
|
||||
View more
|
||||
</a>
|
||||
</dd>
|
||||
</dl>
|
||||
`
|
||||
})
|
||||
|
||||
// NOT USED
|
||||
export class PublishedInComponent {
|
||||
public threshold: number = 5;
|
||||
public showNum: number = 5;
|
||||
|
||||
//key is name
|
||||
@Input() publishedIn: Map<string, {"url": string[], "accessMode": string[], "bestAccessMode": string}>;
|
||||
|
||||
public showAll: boolean = false;
|
||||
|
||||
constructor () {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
public scroll() {
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
public getKeys( map) {
|
||||
return Array.from(map.keys());
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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 {
|
||||
|
||||
}
|
@ -0,0 +1 @@
|
||||
export const search = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 532"><defs><style>.cls-1{isolation:isolate;}.cls-2{fill:{{color}};mix-blend-mode:multiply;}</style></defs><title>Asset 3</title><g class="cls-1"><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-2" d="M0,431s362,109,841,62,632,68,1159-9V0H0Z"/><path class="cls-2" d="M0,514s1401,71,2000-69V0H0Z"/></g></g></g></svg>'
|
Loading…
Reference in New Issue