redesign linking results (cards) to match the new style, fix a css selector for SDG page
This commit is contained in:
parent
1d31c7b234
commit
7e5317e920
|
@ -6,13 +6,9 @@ declare var UIkit: any;
|
|||
@Component({
|
||||
selector: 'claim-results',
|
||||
template: `
|
||||
|
||||
<div *ngIf="results.length > 0 " class="uk-margin-top">
|
||||
<div *ngFor=" let entity of results " [class]="(isSelected(entity))?'uk-block-muted':''" class=" uk-card uk-card-default uk-card-body uk-margin-bottom">
|
||||
<div>
|
||||
<div class="uk-text-small ">
|
||||
{{(!entity.result) ? entity.type : ((entity.result && entity.result.source == 'openaire') ? entity.type : (entity.result && entity.result.source + ' result'))}}
|
||||
</div>
|
||||
<div *ngFor="let entity of results" class="uk-card">
|
||||
<div class="uk-padding-small">
|
||||
<div class="uk-grid">
|
||||
<div class="uk-width-expand uk-margin-right">
|
||||
<claim-title [entity]="entity" [showIcon]="false"></claim-title>
|
||||
|
@ -20,20 +16,19 @@ declare var UIkit: any;
|
|||
<claim-project-metadata [entity]="entity"></claim-project-metadata>
|
||||
</div>
|
||||
<div class="uk-margin-auto-vertical uk-padding-remove-left uk-margin-small-left uk-margin-small-right" [title]="(this.selectedResults.length>=basketLimit)?'Basket reached the size limit':''">
|
||||
<button class="linking-add-button" [class.uk-disabled]="(this.selectedResults.length>=basketLimit)" *ngIf="!isSelected(entity)"
|
||||
<button class="linking-add-button uk-icon-button-small" [class.uk-disabled]="(this.selectedResults.length>=basketLimit)" *ngIf="!isSelected(entity)"
|
||||
(click)="add(entity)">
|
||||
<icon name="add" [flex]="true"></icon>
|
||||
</button>
|
||||
<button *ngIf="isSelected(entity)" class="linking-selected-button" (click)="remove(entity)">
|
||||
<button *ngIf="isSelected(entity)" class="linking-selected-button uk-icon-button-small" (click)="remove(entity)">
|
||||
<icon name="check" [flex]="true"></icon>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>`,
|
||||
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class ClaimResultsComponent {
|
||||
@Input() results: ClaimEntity[];
|
||||
|
@ -41,6 +36,9 @@ export class ClaimResultsComponent {
|
|||
@Input() localStoragePrefix: string = "";
|
||||
@Input() basketLimit;
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
public isSelected(item: ClaimEntity) {
|
||||
return !!this.selectedResults.find(result => item.id === result.id);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ export class SearchDataciteService {
|
|||
|
||||
static parse(response): ClaimEntity[] {
|
||||
const results: ClaimEntity[] = [];
|
||||
console.log(response);
|
||||
for (let i = 0; i < response.length; i++) {
|
||||
const item = response[i];
|
||||
const entity: ClaimEntity = new ClaimEntity();
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
@import (reference) "~src/assets/openaire-theme/less/_import-variables";
|
||||
|
||||
.claim-entity-metadata {
|
||||
|
||||
& > *:not(:last-child):not(.other-separator)::after {
|
||||
content: "\2022";
|
||||
font-weight: normal;
|
||||
margin-left: @global-xsmall-margin;
|
||||
margin-right: @global-xsmall-margin;
|
||||
}
|
||||
}
|
|
@ -4,18 +4,28 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class';
|
|||
@Component({
|
||||
selector: 'claim-project-metadata',
|
||||
template: `
|
||||
<div *ngIf="entity.type == 'project' && entity.project" class="uk-text-small uk-flex uk-flex-wrap" [style.grid-gap]="shortVersion?'10px':'20px'">
|
||||
<div *ngIf="entity.project.funderName">
|
||||
<span class="uk-text-meta">Funder: </span>{{entity.project.funderName}}
|
||||
</div>
|
||||
<div *ngIf="entity.project.code">
|
||||
<span class="uk-text-meta">GrandID: </span>{{entity.project.code}}
|
||||
</div>
|
||||
<div *ngIf=" !shortVersion && (entity.project.startDate || entity.project.endDate)">
|
||||
<span class="uk-text-meta">Duration: </span>{{(entity.project.startDate) ? entity.project.startDate : 'Unknown'}}{{'-' + ((entity.project.endDate) ? entity.project.endDate : 'Unknown')}}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
<ng-container *ngIf="entity.type == 'project' && entity.project">
|
||||
<div *ngIf="!shortVersion" class="claim-entity-metadata uk-flex-inline uk-flex-wrap uk-text-xsmall uk-text-emphasis"
|
||||
[class.uk-margin-xsmall-top]="!shortVersion">
|
||||
<span class="uk-text-capitalize">
|
||||
{{entity.type}}
|
||||
</span>
|
||||
<span *ngIf="entity.project.startDate || entity.project.endDate">
|
||||
{{(entity.project.startDate) ? entity.project.startDate : 'Unknown'}}{{'-' + ((entity.project.endDate) ? entity.project.endDate : 'Unknown')}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="uk-text-small uk-flex uk-flex-wrap" [style.grid-gap]="shortVersion?'10px':'20px'"
|
||||
[class.uk-margin-small-top]="!shortVersion">
|
||||
<div *ngIf="entity.project.funderName">
|
||||
<span class="uk-text-meta">Funder: </span>{{entity.project.funderName}}
|
||||
</div>
|
||||
<div *ngIf="entity.project.code">
|
||||
<span class="uk-text-meta">Project Code: </span>{{entity.project.code}}
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
`,
|
||||
styleUrls: ['ClaimEntityMetadata.component.less']
|
||||
|
||||
|
||||
})
|
||||
|
|
|
@ -4,29 +4,37 @@ import {ClaimEntity} from '../../claim-utils/claimHelper.class';
|
|||
@Component({
|
||||
selector: 'claim-result-metadata',
|
||||
template: `
|
||||
<div *ngIf="entity.result" class="uk-text-small">
|
||||
<div *ngIf="entity.result.authors && entity.result.authors.length >0 " class="uk-margin-small-bottom">
|
||||
<span class="uk-text-meta">Authors: </span>{{sliceArray(entity.result.authors)}}
|
||||
</div>
|
||||
<div *ngIf="!shortVersion && entity.result.editors&& entity.result.editors.length > 0" class="uk-margin-small-bottom">
|
||||
<span class="uk-text-meta">Editors: </span>{{sliceArray(entity.result.editors)}}
|
||||
</div>
|
||||
<div *ngIf="!shortVersion" class="uk-flex uk-flex-wrap" style="grid-gap: 20px;">
|
||||
<span *ngIf="entity.result.publisher!=null">
|
||||
<span class="uk-text-meta uk-margin-small-bottom">Publisher: </span>{{entity.result.publisher}}
|
||||
<div *ngIf="entity.result">
|
||||
<!-- display all existing data similar to entity-metadata -->
|
||||
<div *ngIf="!shortVersion" class="claim-entity-metadata uk-flex-inline uk-flex-wrap uk-text-xsmall uk-text-emphasis uk-margin-xsmall-top">
|
||||
<span class="uk-text-capitalize uk-text-italic">
|
||||
{{(!entity.result) ? entity.type : ((entity.result && entity.result.source == 'openaire') ? entity.type : (entity.result && entity.result.source + ' result'))}}
|
||||
</span>
|
||||
<span *ngIf="entity.result.publisher!=null">
|
||||
{{entity.result.publisher}}
|
||||
</span>
|
||||
<span *ngIf="entity.result.journal!=null">
|
||||
<span class="uk-text-meta uk-margin-small-bottom">Journal: </span>{{entity.result.journal}}
|
||||
</span>
|
||||
<span *ngIf="entity.result.date">
|
||||
<span class="uk-text-meta uk-margin-small-bottom">Published: </span>
|
||||
<span *ngIf="entity.result.date">
|
||||
<span [class]="(getProjectDurationMessage(entity)?'uk-text-warning':'')">{{entity.result.date}}</span>
|
||||
</span>
|
||||
<div [class]="(getProjectDurationMessage(entity)?'uk-text-warning':'')">{{getProjectDurationMessage(entity)}}
|
||||
</div>
|
||||
<span *ngIf="entity.result.journal!=null">
|
||||
{{entity.result.journal}}
|
||||
</span>
|
||||
<div *ngIf="entity.result.editors && entity.result.editors.length > 0">
|
||||
{{sliceArray(entity.result.editors)}}
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="entity.result.authors && entity.result.authors.length > 0" class="uk-flex uk-flex-wrap uk-text-small uk-text-emphasis uk-text-italic"
|
||||
[class.uk-margin-small-top]="!shortVersion">
|
||||
{{sliceArray(entity.result.authors)}}
|
||||
</div>
|
||||
<div class="uk-text-small uk-margin-top">
|
||||
<span *ngIf="getProjectDurationMessage(entity)" [class]="(getProjectDurationMessage(entity)?'uk-text-warning':'')">
|
||||
{{getProjectDurationMessage(entity)}}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
`,
|
||||
styleUrls: ['ClaimEntityMetadata.component.less']
|
||||
|
||||
|
||||
})
|
||||
|
|
|
@ -1,64 +1,67 @@
|
|||
import {Component, Input} from '@angular/core';
|
||||
import {ClaimEntity} from '../../claim-utils/claimHelper.class';
|
||||
import {StringUtils} from "../../../utils/string-utils.class";
|
||||
|
||||
@Component({
|
||||
selector: 'claim-title',
|
||||
template:
|
||||
`
|
||||
<div class="uk-grid uk-flex uk-flex-middle">
|
||||
<span *ngIf="showIcon" class="uk-flex">
|
||||
<span *ngIf=" entity.result" class="material-icons uk-text-small uk-text-meta" >insert_drive_file
|
||||
</span>
|
||||
<span *ngIf=" entity.project"
|
||||
class="material-icons uk-text-small uk-text-meta">assignment_turned_in
|
||||
</span>
|
||||
<span *ngIf="entity.type=='community'" style="margin-right: 2px;"
|
||||
class="material-icons uk-text-small uk-text-meta">people
|
||||
</span></span>
|
||||
<div class="uk-width-expand " style="word-break: break-word;" [class.uk-h6]="!shortVersion" [class.uk-text-bold]="shortVersion" [class.uk-text-truncate]="shortVersion" [class.uk-margin-bottom]="!shortVersion" [class.uk-padding-remove-left]="showIcon">
|
||||
|
||||
<a *ngIf="entity.result && entity.result.url" target="_blank" [href]="entity.result.url"
|
||||
class="uk-link uk-link-heading">{{entity.title ? sliceString(entity.title) : '[No title available]'}}</a>
|
||||
<span
|
||||
*ngIf="(entity.result && !entity.result.url)">{{entity.title ? sliceString(entity.title) : '[No title available]'}}</span>
|
||||
<span *ngIf="entity.type=='project' && entity.project">
|
||||
<a *ngIf="entity.project && entity.project.url" target="_blank" [href]="entity.project.url"
|
||||
class="uk-text-link">
|
||||
<span *ngIf="!shortVersion">
|
||||
{{(entity.project.acronym ? '[' + entity.project.acronym + '] ' : '') + entity.title}}
|
||||
</span>
|
||||
<span *ngIf="shortVersion">
|
||||
{{(entity.project.acronym ? sliceString(entity.project.acronym):sliceString(entity.title))}}
|
||||
</span>
|
||||
template: `
|
||||
<div class="uk-grid uk-flex uk-flex-middle">
|
||||
<span *ngIf="showIcon" class="uk-flex">
|
||||
<span *ngIf="entity.result" class="material-icons uk-text-small uk-text-meta">
|
||||
insert_drive_file
|
||||
</span>
|
||||
<span *ngIf="entity.project" class="material-icons uk-text-small uk-text-meta">
|
||||
assignment_turned_in
|
||||
</span>
|
||||
<span *ngIf="entity.type=='community'" class="material-icons uk-text-small uk-text-meta" style="margin-right: 2px;">
|
||||
people
|
||||
</span>
|
||||
</span>
|
||||
<div class="uk-width-expand multi-line-ellipsis lines-3" style="word-break: break-word;"
|
||||
[class.uk-padding-remove-left]="showIcon" [class.uk-text-truncate]="shortVersion">
|
||||
<div class="uk-margin-remove uk-text-break uk-inline-block"
|
||||
[class.uk-h6]="!shortVersion" [class.uk-text-bold]="shortVersion">
|
||||
<a *ngIf="entity.result && entity.result.url" target="_blank" [href]="entity.result.url"
|
||||
class="uk-link uk-text-decoration-none uk-width-expand">
|
||||
{{entity.title ? sliceString(entity.title) : '[No title available]'}}
|
||||
</a>
|
||||
<span
|
||||
*ngIf="(entity.project && !entity.project.url)">
|
||||
<span *ngIf="!shortVersion">
|
||||
{{(entity.project.acronym ? '[' + entity.project.acronym + '] ' : '') + entity.title}}
|
||||
</span>
|
||||
<span *ngIf="shortVersion">
|
||||
{{(entity.project.acronym ? sliceString(entity.project.acronym):sliceString(entity.title))}}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
|
||||
</span>
|
||||
<span *ngIf="entity.type=='community' && entity.context">
|
||||
<span *ngIf=" entity.context.community != entity.context.concept.label">
|
||||
{{entity.context.community }} > {{entity.context.category}} >
|
||||
</span>
|
||||
<span> {{entity.context.concept.label}}</span>
|
||||
</span>
|
||||
<span *ngIf="(entity.result && !entity.result.url)">
|
||||
{{entity.title ? sliceString(entity.title) : '[No title available]'}}
|
||||
</span>
|
||||
<span *ngIf="entity.type=='project' && entity.project">
|
||||
<a *ngIf="entity.project && entity.project.url" target="_blank" [href]="entity.project.url"
|
||||
class="uk-link uk-text-decoration-none uk-width-expand">
|
||||
<span *ngIf="!shortVersion">
|
||||
{{(entity.project.acronym ? '[' + entity.project.acronym + '] ' : '') + entity.title}}
|
||||
</span>
|
||||
<span *ngIf="shortVersion">
|
||||
{{(entity.project.acronym ? sliceString(entity.project.acronym):sliceString(entity.title))}}
|
||||
</span>
|
||||
</a>
|
||||
<span *ngIf="(entity.project && !entity.project.url)">
|
||||
<span *ngIf="!shortVersion">
|
||||
{{(entity.project.acronym ? '[' + entity.project.acronym + '] ' : '') + entity.title}}
|
||||
</span>
|
||||
<span *ngIf="shortVersion">
|
||||
{{(entity.project.acronym ? sliceString(entity.project.acronym):sliceString(entity.title))}}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span *ngIf="entity.type=='community' && entity.context">
|
||||
<span *ngIf=" entity.context.community != entity.context.concept.label">
|
||||
{{entity.context.community }} > {{entity.context.category}} >
|
||||
</span>
|
||||
<span>
|
||||
{{entity.context.concept.label}}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
||||
|
||||
})
|
||||
export class ClaimEntityTitleComponent {
|
||||
|
||||
|
||||
@Input() entity: ClaimEntity;
|
||||
@Input() slice:boolean = false;
|
||||
@Input() sliceSize:number = 45;
|
||||
|
@ -66,14 +69,13 @@ export class ClaimEntityTitleComponent {
|
|||
@Input() showIcon: boolean = false;
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
sliceString(mystr:string): string {
|
||||
if(this.slice){
|
||||
if(this.slice){
|
||||
// return StringUtils.sliceString(mystr,this.sliceSize);
|
||||
}
|
||||
return mystr;
|
||||
}
|
||||
return mystr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
<div class=" uk-margin uk-animation-toggle">
|
||||
<span class="uk-h6 "> SOURCES ({{sources.length + (inlineEntity ? 1 : 0) | number}})
|
||||
</span>
|
||||
<a *ngIf="!inlineEntity" class="uk-float-right" (click)="showOptions.showSource() "> <span
|
||||
uk-icon="pencil"></span>Edit
|
||||
<a *ngIf="!inlineEntity" class="uk-float-right uk-text-small" (click)="showOptions.showSource() "> <span
|
||||
uk-icon="pencil" class="uk-margin-xsmall-right"></span>Edit
|
||||
sources</a>
|
||||
</div>
|
||||
<ul *ngIf="inlineEntity" class="uk-list uk-animation-fade uk-list-divider">
|
||||
|
@ -51,10 +51,10 @@
|
|||
<ul *ngIf="!inlineEntity && sources.length > 0 " class="uk-list uk-animation-fade uk-list-divider">
|
||||
<li *ngFor=" let entity of sources ">
|
||||
<div class="uk-grid uk-text-small uk-margin-top">
|
||||
<div class="uk-text-muted uk-width-1-2 uk-flex uk-flex-middle">
|
||||
<!-- <div class="uk-text-muted uk-width-1-2 uk-flex uk-flex-middle">
|
||||
<span class="material-icons uk-text-small uk-text-meta">insert_drive_file</span>
|
||||
{{(!entity.result) ? entity.type : ((entity.result && entity.result.source == 'openaire') ? entity.type : (entity.result && entity.result.source + ' result'))}}
|
||||
</div>
|
||||
</div> -->
|
||||
<div *ngIf="entity.errorMessages.length > 0"
|
||||
class="uk-text-danger uk-width-1-2"> Link couldn't be saved
|
||||
</div>
|
||||
|
@ -157,8 +157,8 @@
|
|||
<span class=" uk-h6 "> LINK TO ({{results.length | number}})</span>
|
||||
|
||||
|
||||
<a class="uk-float-right" (click)="showOptions.showLinkTo()"> <span
|
||||
uk-icon="pencil"></span>Edit
|
||||
<a class="uk-float-right uk-text-small" (click)="showOptions.showLinkTo()"> <span
|
||||
uk-icon="pencil" class="uk-margin-xsmall-right"></span>Edit
|
||||
entities</a>
|
||||
</div>
|
||||
<div *ngIf="results.length == 0">
|
||||
|
@ -174,7 +174,7 @@
|
|||
<li *ngFor=" let entity of results "
|
||||
style="z-index: 0 !important;">
|
||||
<div class="uk-grid uk-text-small uk-margin-top">
|
||||
<div class="uk-text-muted uk-width-1-2 uk-flex uk-flex-middle">
|
||||
<!-- <div class="uk-text-muted uk-width-1-2 uk-flex uk-flex-middle">
|
||||
<span *ngIf="entity.result" class="material-icons uk-text-small uk-text-meta">insert_drive_file
|
||||
</span>
|
||||
<span *ngIf="entity.project"
|
||||
|
@ -184,7 +184,7 @@
|
|||
class="material-icons uk-text-small uk-text-meta">people
|
||||
</span>
|
||||
{{(!entity.result) ? entity.type : ((entity.result && entity.result.source == 'openaire') ? entity.type : (entity.result && entity.result.source + ' result'))}}
|
||||
</div>
|
||||
</div> -->
|
||||
<div *ngIf="entity.errorMessages.length > 0"
|
||||
class="uk-text-danger uk-width-1-2"> Link couldn't be saved
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
@sdgs: #E6233D, #DF9F00, #19A220, #D70023, #FF0B00, #00BFE8, #FFC300, #B10240, #FF5D00,
|
||||
#F50D86, #FF8A00, #CA8A03, #2B772B, #0098DF, #00B91C, #0069A2, #1C336A;
|
||||
|
||||
custom-sdg-dot:after {
|
||||
.custom-sdg-dot:after {
|
||||
content: "";
|
||||
background-image: url("~src/assets/common-assets/sdg/sdg-dot-img.svg");
|
||||
display: inline-block;
|
||||
|
|
Loading…
Reference in New Issue