0 && searchUtils.status == errorCodes.LOADING">
{{oldTotalResults|number}} {{type}}, page {{searchUtils.page | number}} of {{(totalPages(oldTotalResults)|number)}}
-
searchUtils.size">
+
-
searchUtils.size && searchUtils.status == errorCodes.LOADING">
+
searchUtils.size && searchUtils.status == errorCodes.LOADING">
diff --git a/searchPages/searchUtils/searchPaging.module.ts b/searchPages/searchUtils/searchPaging.module.ts
index 4a403bd1..122a35e5 100644
--- a/searchPages/searchUtils/searchPaging.module.ts
+++ b/searchPages/searchUtils/searchPaging.module.ts
@@ -1,9 +1,9 @@
-import { NgModule} from '@angular/core';
-import { CommonModule } from '@angular/common';
-import { FormsModule } from '@angular/forms';
+import {NgModule} from '@angular/core';
+import {CommonModule} from '@angular/common';
+import {FormsModule} from '@angular/forms';
-import{SearchPagingComponent} from './searchPaging.component';
-import{PagingModule} from '../../utils/paging.module';
+import {SearchPagingComponent} from './searchPaging.component';
+import {PagingModule} from '../../utils/paging.module';
@NgModule({
imports: [
@@ -11,13 +11,10 @@ import{PagingModule} from '../../utils/paging.module';
],
declarations: [
SearchPagingComponent
-],
-
- providers:[
],
exports: [
SearchPagingComponent
-
- ]
+ ]
})
-export class SearchPagingModule { }
+export class SearchPagingModule {
+}
diff --git a/searchPages/searchUtils/searchResult.component.html b/searchPages/searchUtils/searchResult.component.html
index 66e062ea..03a74efe 100644
--- a/searchPages/searchUtils/searchResult.component.html
+++ b/searchPages/searchUtils/searchResult.component.html
@@ -2,199 +2,9 @@
-
-
-
- {{(result.entityType) ? getTypeName(result.entityType) : getTypeName(type)}}
-
- . {{result.type}}
- 0">
- {{' . '}}
-
- 0">
- {{' . '}}
-
- {{' . ' + result.year.toString()}}
- . {{result.startYear}} - {{result.endYear}}
-
- . Embargo End Date: {{result.embargoEndDate | date: 'dd MMM yyyy'}}
-
-
-
-
-
-
-
-
-
-
-
- Funder:
-
-
-
- Project Code:
-
-
-
-
-
-
- {{result.title.accessMode}}
- {{' '}}
-
- {{result.title.accessMode}}
- {{' '}}
-
- Open Access mandate for Publications
- {{' '}}
-
- Open Access mandate for Research Data
- {{' '}}
-
- Open Access mandate for Publications and Research Data
- {{' '}}
- 0">
-
-
- {{' '}}
-
- 0">
-
-
- {{' '}}
-
- Special Clause 39
- {{' '}}
-
- {{result.compatibility}}
- {{' '}}
-
-
-
- Publisher:
-
-
-
-
0"
- class="uk-text-small uk-margin-small-bottom">
- Country:
-
-
-
- Country:
-
-
-
0" class="uk-text-small uk-margin-small-bottom">
- Country:
- {{country}}{{(i < (result['countries'].slice(0, 10).length - 1)) ? ", " : ""}}
- {{(i == result['countries'].slice(0, 10).length - 1 && result['countries'].length > 10) ? "..." : ""}}
-
-
-
0"
- class="uk-text-small uk-margin-small-bottom">
- Programming language: {{result.programmingLanguages.join(", ")}}
-
-
-
0" class="uk-text-small uk-margin-small-bottom">
- Project:
-
-
- {{project['funderShortname'] ? project['funderShortname'] : project['funderName']}}
-
-
- | {{ project['acronym'] ? project['acronym'] : (project['title'].length > 25 ?
- project['title'].substring(0, 25) + '...' : project['title'])}}
-
- ({{project.code}})
- ,
-
- 10">...
-
-
-
0"
- class="uk-text-small uk-margin-small-bottom">
- Organization:
-
- {{organization.name}}
- ,
-
- 10">...
-
-
-
-
-
-
-
0"
- class="uk-text-small uk-margin-small-bottom">
- Subject:
- {{subject}}
- {{(i < (result.subjects.slice(0, 10).length - 1)) ? ", " : ""}}
- {{(i == result.subjects.slice(0, 10).length - 1 && result.subjects.length > 10) ? "..." : ""}}
-
-
-
-
+
+
diff --git a/searchPages/searchUtils/searchResult.component.ts b/searchPages/searchUtils/searchResult.component.ts
index 7c709b92..a7e7fd59 100644
--- a/searchPages/searchUtils/searchResult.component.ts
+++ b/searchPages/searchUtils/searchResult.component.ts
@@ -4,13 +4,13 @@ import {ErrorCodes} from '../../utils/properties/errorCodes';
import {RouterHelper} from '../../utils/routerHelper.class';
import {EnvProperties} from '../../utils/properties/env-properties';
import {Keyword} from "./highlight/highlight.component";
+import {ResultPreview} from "../../utils/result-preview/result-preview";
@Component({
selector: 'search-result',
templateUrl: 'searchResult.component.html'
})
export class SearchResultComponent implements OnInit {
- @Input() keywords: Keyword[];
@Input() results: SearchResult[];
@Input() status: number;
@Input() type: string;
@@ -19,77 +19,18 @@ export class SearchResultComponent implements OnInit {
@Input() showOrganizations: boolean = true;
@Input() custom_class: string = "search-results";
@Input() properties: EnvProperties;
- public urlParam: string;
- public errorCodes: ErrorCodes = new ErrorCodes();
- public routerHelper: RouterHelper = new RouterHelper();
- public errorMessage: string = "No results found";
constructor() {
}
- ngOnInit() {
- if (this.type == "project") {
- this.urlParam = "projectId";
- } else if (this.type == "organization") {
- this.urlParam = "organizationId";
- } else if (this.type == "dataprovider") {
- this.urlParam = "datasourceId";
- }
+ ngOnInit() {}
+
+ public getResultPreview(result: SearchResult): ResultPreview {
+ return ResultPreview.searchResultConvert(result, (result.entityType)?result.entityType:this.type);
}
- /**
- * Returns query param name base on result's entity type
- *
- * @param type
- */
- public queryParamName(type: string): string {
- if (type === "publication") {
- return "articleId";
- } else if (type === "dataset") {
- return "datasetId";
- } else if (type === "software") {
- return "softwareId";
- } else if (type === "other") {
- return "orpId";
- }
- }
-
- public getTypeName(type: string): string {
- if (type === "dataset") {
- return "research data";
- } else if (type === "other") {
- return "other research outcome";
- } else if (type === "dataprovider") {
- return "content provider";
- } else {
- return type;
- }
- }
-
- public removeUnknown(array: string[], type: string = null): string[] {
- if (type) {
- return this.removeDuplicates(array, type).filter(value => value.toLowerCase() !== 'unknown');
- } else {
- return array.filter(value => value.toLowerCase() !== 'unknown');
- }
- }
-
- public removeDuplicates(array: string[], type: string): string[] {
- type = this.getTypeName(type);
- return array.filter(value => value.toLowerCase() !== type);
- }
public quote(params: string): string {
return '"' + params + '"';
}
-
- public accessClass(accessMode: string): string {
- if(accessMode.toLowerCase().indexOf('open') !== -1) {
- return 'open';
- } else if(accessMode.toLowerCase() === 'not available') {
- return 'unknown';
- } else {
- return 'closed';
- }
- }
}
diff --git a/searchPages/searchUtils/searchResults.module.ts b/searchPages/searchUtils/searchResults.module.ts
index a944b5d7..94ce2e92 100644
--- a/searchPages/searchUtils/searchResults.module.ts
+++ b/searchPages/searchUtils/searchResults.module.ts
@@ -8,13 +8,14 @@ import {SearchResultComponent} from './searchResult.component';
import {ApprovedByCommunityModule} from '../../connect/approvedByCommunity/approved.module';
import {ShowAuthorsModule} from "../../utils/authors/showAuthors.module";
import {HighlightModule} from "./highlight/highlight.module";
+import {ResultPreviewModule} from "../../utils/result-preview/result-preview.module";
@NgModule({
imports: [
CommonModule, FormsModule,
RouterModule, ErrorMessagesModule,
ApprovedByCommunityModule,
- ShowAuthorsModule, HighlightModule
+ ShowAuthorsModule, HighlightModule, ResultPreviewModule
],
declarations: [
SearchResultComponent
diff --git a/utils/altmetrics.component.ts b/utils/altmetrics.component.ts
index ab3c7292..71104099 100644
--- a/utils/altmetrics.component.ts
+++ b/utils/altmetrics.component.ts
@@ -1,6 +1,6 @@
-import {Component, ElementRef, Input} from '@angular/core';
- import {SafeHtmlPipe} from '../utils/pipes/safeHTML.pipe';
- import {ActivatedRoute} from '@angular/router';
+import {Component, Input} from '@angular/core';
+import {ActivatedRoute} from '@angular/router';
+
declare var loadAltmetrics:any;
//
@Component({
@@ -34,8 +34,9 @@ export class AltMetricsComponent {
// let yourModule = require('../utils/altmetrics.js');
loadAltmetrics("altmetric-embed-js","https://d1bxh8uas1mnw7.cloudfront.net/assets/altmetric_badges-8f271adb184c21cc5169a7f67f7fe5ab.js");
}
- });
+ });
}
+
ngOnDestroy() {
this.sub.unsubscribe();
}
diff --git a/utils/entities/searchResult.ts b/utils/entities/searchResult.ts
index acea3e27..099f6c9c 100644
--- a/utils/entities/searchResult.ts
+++ b/utils/entities/searchResult.ts
@@ -1,27 +1,4 @@
-export class Project {
- funderShortname: string;
- funderName: string;
- acronym: string;
- title: string;
- code: string;
- id: string;
-}
-
-export class Author {
- fullName: string;
- orcid: string;
-}
-
-export class ResultTitle {
- name: string;
- accessMode: string;
- sc39: string;
-}
-
-export class Organization {
- id: string;
- name: string;
-}
+import {Author, Organization, Project, ResultTitle} from "../result-preview/result-preview";
export class SearchResult {
title: ResultTitle;
@@ -54,6 +31,9 @@ export class SearchResult {
acronym: string;
code: string;
funderShortname: string;
+ budget?: string;
+ contribution?: string;
+ currency?: string;
startYear: number;
endYear: number;
openAccessMandatePublications: boolean;
diff --git a/utils/paging.module.ts b/utils/paging.module.ts
index dbf53c87..942cc50e 100644
--- a/utils/paging.module.ts
+++ b/utils/paging.module.ts
@@ -1,7 +1,7 @@
-import { NgModule } from '@angular/core';
-import { CommonModule } from '@angular/common';
-import { FormsModule } from '@angular/forms';
-import { RouterModule } from '@angular/router';
+import {NgModule} from '@angular/core';
+import {CommonModule} from '@angular/common';
+import {FormsModule} from '@angular/forms';
+import {RouterModule} from '@angular/router';
import {pagingFormatterNoLoad} from './pagingFormatterNoLoad.component';
@@ -15,14 +15,10 @@ import {PagingFormatter} from './pagingFormatter.component';
declarations: [
pagingFormatterNoLoad,
PagingFormatter,
-
-
],
exports: [
- pagingFormatterNoLoad,
- PagingFormatter,
-
-
- ]
+ pagingFormatterNoLoad,
+ PagingFormatter,
+ ]
})
-export class PagingModule { }
+export class PagingModule {}
diff --git a/utils/pagingFormatterNoLoad.component.ts b/utils/pagingFormatterNoLoad.component.ts
index 89a8aaa8..ad3518c5 100644
--- a/utils/pagingFormatterNoLoad.component.ts
+++ b/utils/pagingFormatterNoLoad.component.ts
@@ -7,7 +7,8 @@ import{EnvProperties} from './properties/env-properties';
@Component({
selector: 'paging-no-load',
template: `
-
0 ) && (getTotalPages() > 1) && ( 0 < currentPage && currentPage <= getTotalPages() ) " class="uk-pagination">
+