Add subjects

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@51036 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
sofia.baltzi 2018-03-05 13:47:46 +00:00
parent 843d77efbf
commit f65fcb4216
5 changed files with 66 additions and 7 deletions

View File

@ -46,6 +46,20 @@ export class CommunitiesService {
}
}
if(resData[0].subjects != null) {
if(result['subjects'] == undefined) {
result['subjects'] = new Array<string>();
}
let subjects = resData[0].subjects;
let length = Array.isArray(subjects) ? subjects.length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(subjects) ? subjects[i] : subjects;
result.subjects[i] = subject;
}
}
} else {
result['title'] = resData.name;
result['shortTitle'] = resData.shortName;
@ -67,6 +81,20 @@ export class CommunitiesService {
result.managers[i] = manager;
}
}
if(resData.subjects != null) {
if(result['subjects'] == undefined) {
result['subjects'] = new Array<string>();
}
let subjects = resData.subjects;
let length = Array.isArray(subjects) ? subjects.length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(subjects) ? subjects[i] : subjects;
result.subjects[i] = subject;
}
}
}
communities.push(result);
}

View File

@ -16,10 +16,14 @@
<p> {{community.description}}</p>
</div>
</blockquote>
<p><span class="uk-label">Nature</span>&nbsp;<span class=" uk-label uk-label-danger">Life science</span>&nbsp;<span class="uk-label uk-label-success">Environment</span></p>
<div *ngFor='let manager of community.managers; let i = index'>
<p> <span>Curated by: {{manager}} </span> <span class="uk-margin-left"> Created: 26-01-2018</span> </p>
<div *ngIf="community.subjects != null">
<p *ngFor='let subject of community.subjects; let i = index'> <span class="uk-label"> {{subject}}</span>&nbsp;</p>
</div>
<p><span *ngIf="community.managers !=null">
<span *ngFor='let manager of community.managers; let i = index'>Curated by: {{manager}} </span>
</span>
<span class="uk-margin-left"> Created: 26-01-2018</span>
</p>
</div>
<div class="uk-child-width-1-6@l uk-child-width-1-6@m uk-child-width-1-3@s uk-text-center uk-grid" uk-grid="">
<div class="uk-first-column">

View File

@ -84,7 +84,7 @@ export class CommunityComponent {
community => {
this.community = community;
this.params = {community: encodeURIComponent('"'+community.queryId+'"')};
//console.log(community);
console.log(community);
});
this._communityService.getTotal('http://beta.services.openaire.eu:8480/search/rest/v2/api/publications/count?format=json&fq=communityid='+this.communityId).subscribe(

View File

@ -112,7 +112,6 @@ export class CommunityService {
community['description'] = resData[0].description;
if(resData[0].managers != null) {
if(community['managers'] == undefined) {
community['managers'] = new Array<string>();
}
@ -126,6 +125,20 @@ export class CommunityService {
}
}
if(resData[0].subjects != null) {
if(community['subjects'] == undefined) {
community['subjects'] = new Array<string>();
}
let subjects = resData[0].subjects;
let length = Array.isArray(subjects) ? subjects.length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(subjects) ? subjects[i] : subjects;
community.subjects[i] = subject;
}
}
} else if(!Array.isArray(resData)) {
community['title'] = resData.name;
@ -148,6 +161,20 @@ export class CommunityService {
community.managers[i] = manager;
}
}
if(resData.subjects != null) {
if(community['subjects'] == undefined) {
community['subjects'] = new Array<string>();
}
let subjects = resData.subjects;
let length = Array.isArray(subjects) ? subjects.length : 1;
for(let i=0; i<length; i++) {
let subject = Array.isArray(subjects) ? subjects[i] : subjects;
community.subjects[i] = subject;
}
}
}
}
return community;

View File

@ -6,6 +6,6 @@ export class CommunityInfo {
logoUrl: string;
description: string;
managers: string[];
date:string;
subject: string[];
date:Date;
subjects: string[];
}