[Library | Trunk]: 1. Add project name as subtitle if acrony and name are existed. 2. Remove isClient condition, which made menu hidden on server mode.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58285 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2020-03-17 13:55:34 +00:00
parent cd6642d7b2
commit 9d69da41fd
3 changed files with 17 additions and 71 deletions

View File

@ -1,5 +1,6 @@
import {Component, Input} from '@angular/core'; import {Component, Input} from '@angular/core';
import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {HelperFunctions} from "../../utils/HelperFunctions.class";
import {Project} from "../../utils/result-preview/result-preview";
@Component({ @Component({
selector: 'fundedBy', selector: 'fundedBy',
@ -7,7 +8,7 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
<li> <li>
<span class="uk-text-muted">Funded by: </span> <span class="uk-text-muted">Funded by: </span>
<span *ngFor="let item of fundedByProjects.slice(0, showNum) let i=index"> <span *ngFor="let item of fundedByProjects.slice(0, showNum) let i=index">
<span class="clickable uk-link"> <a class="cursor-default">
<mark *ngIf="item.inline"> <mark *ngIf="item.inline">
<span *ngIf="item['funderShortname'] || item['funderName']">{{item['funderShortname']?item['funderShortname']:item['funderName']}}</span> <span *ngIf="item['funderShortname'] || item['funderName']">{{item['funderShortname']?item['funderShortname']:item['funderName']}}</span>
<span *ngIf="!item['funderShortname'] && !item['funderName']">[no funder available]</span> <span *ngIf="!item['funderShortname'] && !item['funderName']">[no funder available]</span>
@ -18,18 +19,21 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
<span *ngIf="!item['funderShortname'] && !item['funderName']">[no funder available]</span> <span *ngIf="!item['funderShortname'] && !item['funderName']">[no funder available]</span>
<span *ngIf="item['acronym'] || item['title']">| {{ item['acronym']?item['acronym']:item['title']}}</span> <span *ngIf="item['acronym'] || item['title']">| {{ item['acronym']?item['acronym']:item['title']}}</span>
</span> </span>
</span> </a>
<div class="default-dropdown uk-margin-remove-top uk-padding-small" <div class="default-dropdown uk-margin-remove-top uk-padding-small"
uk-dropdown="pos: bottom-left; mode:click"> uk-dropdown="pos: bottom-left; mode:click">
<span class="uk-text-small">Project</span> <span class="uk-text-small">Project</span>
<div class="uk-margin-bottom"> <div class="uk-margin-bottom">
<a *ngIf="item.id" class="uk-h6 uk-margin-remove" <a *ngIf="item.id" class="uk-h6 uk-margin-remove portal-link"
[queryParams]="{projectId: item.id}" routerLink="/search/project"> [queryParams]="{projectId: item.id}" routerLink="/search/project">
{{item['acronym']?item['acronym']:item['title']}} {{item['acronym']?item['acronym']:item['title']}}
</a> </a>
<span *ngIf="!item.id" class="uk-h6 uk-margin-remove"> <span *ngIf="!item.id" class="uk-h6 uk-margin-remove">
{{item['acronym']?item['acronym']:item['title']}} {{item['acronym']?item['acronym']:item['title']}}
</span> </span>
<div *ngIf="item.acronym && item.title">
{{item.title}}
</div>
</div> </div>
<ul class="uk-list uk-padding-remove-left uk-margin-bottom"> <ul class="uk-list uk-padding-remove-left uk-margin-bottom">
<li *ngIf="item.funderShortname || item.funderName"> <li *ngIf="item.funderShortname || item.funderName">
@ -67,61 +71,11 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
}) })
export class FundedByComponent { export class FundedByComponent {
@Input() fundedByProjects: { "id": string, "acronym": string, "title": string, @Input() fundedByProjects: Project[];
"funderShortname": string, "funderName": string,
"funding": string, "code": string, "provenanceAction": string,
"inline": boolean }[];
public threshold: number = 5; public threshold: number = 5;
public showNum: number = 5; public showNum: number = 5;
constructor () {}
ngOnInit() {}
public buildFundingTooltip(item: { "id": string, "acronym": string, "title": string,
"funderShortname": string, "funderName": string,
"funding": string, "code": string, "provenanceAction": string, inline: boolean}) {
let tooltipContent: string = "<div class='tooltip-custom-font-size uk-padding-small uk-light'>";
if(item.title) {
tooltipContent += "<p class='uk-h5'>"+item.title+"</p>";
}
if(item.code || item.funderName || item.funderShortname || item.funding) {
tooltipContent += "<p>";
}
if(item.code) {
tooltipContent += "<div>Project Code: "+item.code+"</div>";
}
if(item.funderName || item.funderShortname) {
tooltipContent += "<div>Funder: ";
if(item.funderName && item.funderShortname) {
tooltipContent += item.funderName + " ("+ item.funderShortname +")";
} else if(item.funderName) {
tooltipContent += item.funderName;
} else {
tooltipContent += item.funderShortname;
}
tooltipContent += "</div>";
}
if(item.funding) {
tooltipContent += "<div>Funding: "+ item.funding + "</div>";
}
if(item.code || item.funderName || item.funderShortname || item.funding) {
tooltipContent += "</p>";
}
tooltipContent += "<span class='uk-text-small'>";
tooltipContent += item.provenanceAction;
tooltipContent += "</span>";
tooltipContent+="</div>";
return tooltipContent;
}
public scroll() { public scroll() {
HelperFunctions.scroll(); HelperFunctions.scroll();
} }

View File

@ -43,7 +43,7 @@
<button class="uk-offcanvas-close uk-close uk-icon" type="button" uk-close=""></button> <button class="uk-offcanvas-close uk-close uk-icon" type="button" uk-close=""></button>
<div class="uk-child-width-1-1 uk-grid" uk-grid=""> <div class="uk-child-width-1-1 uk-grid" uk-grid="">
<div> <div>
<div *ngIf= "isClient" class="uk-panel" id="module-0"> <div class="uk-panel" id="module-0">
<ul class="uk-nav uk-nav-default"> <ul class="uk-nav uk-nav-default">
<li class="uk-nav-header uk-parent" > <li class="uk-nav-header uk-parent" >
Dashboards Dashboards
@ -176,7 +176,7 @@
<!-- <div *ngIf="!onlyTop" class="uk-navbar-center"> --> <!-- <div *ngIf="!onlyTop" class="uk-navbar-center"> -->
<div *ngIf="!onlyTop" class="uk-navbar-right uk-position-top-right"> <div *ngIf="!onlyTop" class="uk-navbar-right uk-position-top-right">
<ul *ngIf= "isClient" [class]="'uk-navbar-nav'+(!userMenu?' uk-margin-right':'')"> <ul [class]="'uk-navbar-nav'+(!userMenu?' uk-margin-right':'')">
<li class="uk-parent" *ngIf="showHomeMenuItem && getCurrentRoute()!='/'"> <li class="uk-parent" *ngIf="showHomeMenuItem && getCurrentRoute()!='/'">
<a routerLinkActive="uk-link" routerLink="/">Home</a> <a routerLinkActive="uk-link" routerLink="/">Home</a>
</li> </li>

View File

@ -32,7 +32,6 @@ export class NavigationBarComponent {
public isAuthorized: boolean = false; public isAuthorized: boolean = false;
sub: any; sub: any;
isClient: boolean = false;
showEntity = {}; showEntity = {};
showPage = {}; showPage = {};
specialAnnouncementContent: string = null; specialAnnouncementContent: string = null;
@ -45,13 +44,6 @@ export class NavigationBarComponent {
} }
ngOnInit() { ngOnInit() {
//console.log(this.menuItems);
if (typeof document !== 'undefined') {
try {
this.isClient = true;
} catch (e) {
}
}
this.activeRouteEnabled = false; this.activeRouteEnabled = false;
this.sub = this.route.queryParams.subscribe(params => { this.sub = this.route.queryParams.subscribe(params => {
this.initialize(); this.initialize();