Revision 60288
Added by Argiro Kokogiannaki about 3 years ago
modules/uoa-connect-portal/trunk/src/app/deposit/zenodo/shareInZenodo.module.ts | ||
---|---|---|
15 | 15 |
import {Schema2jsonldModule} from "../../openaireLibrary/sharedComponents/schema2jsonld/schema2jsonld.module"; |
16 | 16 |
import {SEOServiceModule} from "../../openaireLibrary/sharedComponents/SEO/SEOService.module"; |
17 | 17 |
import {BreadcrumbsModule} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.module"; |
18 |
import {NoLoadPaging} from "../../openaireLibrary/searchPages/searchUtils/no-load-paging.module"; |
|
18 | 19 |
|
19 | 20 |
@NgModule({ |
20 | 21 |
imports: [ |
21 | 22 |
CommonModule, ShareInZenodoRoutingModule, ZenodoCommunitiesServiceModule, SearchZenodoCommunitiesServiceModule, |
22 | 23 |
RouterModule, HelperModule, |
23 |
PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule |
|
24 |
PiwikServiceModule, Schema2jsonldModule, SEOServiceModule, BreadcrumbsModule, NoLoadPaging
|
|
24 | 25 |
], |
25 | 26 |
declarations: [ |
26 | 27 |
ShareInZenodoComponent |
modules/uoa-connect-portal/trunk/src/app/deposit/zenodo/shareInZenodo.component.html | ||
---|---|---|
83 | 83 |
class="uk-animation-fade uk-margin-top uk-width-1-1 uk-alert uk-alert-warning" role="alert"> |
84 | 84 |
No zenodo communities found |
85 | 85 |
</div> |
86 |
<ul *ngIf="communities.length > 0" class="uk-list uk-margin uk-margin-large-top"> |
|
87 |
Other related Zenodo communities ({{communities.length}}) |
|
88 |
<li *ngFor="let item of communities;" class="uk-animation-fade uk-margin-top"> |
|
86 |
<div class="uk-margin-large-top">Other related Zenodo communities <span *ngIf="communityIds && |
|
87 |
communityIds.length <= size">({{communityIds.length}})</span></div> |
|
88 |
<no-load-paging *ngIf="communityIds && communityIds.length > size" [type]="'Zenodo communities'" |
|
89 |
(pageChange)="getCommunities($event)" |
|
90 |
[page]="page" [pageSize]="size" |
|
91 |
[totalResults]="communityIds.length" > |
|
92 |
</no-load-paging> |
|
93 |
<ul *ngIf="communityIds && communityIds.length > 0" class="uk-list uk-margin "> |
|
94 |
|
|
95 |
<ng-template ngFor let-item [ngForOf]="communityIds" let-i="index" > |
|
96 |
<li *ngIf="i>=((page-1)*size) && i < communityIds.length && i< this.page * this.size && |
|
97 |
communities[this.communityIds[i]['zenodoid']]" |
|
98 |
class="uk-animation-fade uk-margin-top"> |
|
89 | 99 |
<div class=" uk-card uk-card-default uk-card-body uk-padding-remove-horizontal"> |
90 | 100 |
<div class="uk-comment-header uk-grid-medium uk-flex-middle uk-padding uk-padding-remove-vertical" uk-grid> |
91 | 101 |
<div class="uk-width-auto"> |
92 |
<a target="_blank" [href]="item.link">
|
|
93 |
<img *ngIf="item.logoUrl" class="uk-comment-avatar" src="{{item.logoUrl}}" width="80" height="80"
|
|
102 |
<a target="_blank" [href]="communities[this.communityIds[i]['zenodoid']].link">
|
|
103 |
<img *ngIf="communities[this.communityIds[i]['zenodoid']].logoUrl" class="uk-comment-avatar" src="{{communities[this.communityIds[i]['zenodoid']].logoUrl}}" width="80" height="80"
|
|
94 | 104 |
alt=""> |
95 | 105 |
</a> |
96 | 106 |
</div> |
97 | 107 |
<div class="uk-width-expand"> |
98 | 108 |
<h4 class="uk-comment-title uk-margin-remove"> |
99 |
<a class="uk-width-expand" target="_blank" href="{{item.link}}">
|
|
109 |
<a class="uk-width-expand" target="_blank" href="{{communities[this.communityIds[i]['zenodoid']].link}}">
|
|
100 | 110 |
<span class="custom-external custom-icon large"></span> |
101 | 111 |
<span class="space"></span> |
102 |
<span *ngIf="item.title">{{item.title}}</span>
|
|
103 |
<span *ngIf="!item.title">[no name available]</span>
|
|
112 |
<span *ngIf="communities[this.communityIds[i]['zenodoid']].title">{{communities[this.communityIds[i]['zenodoid']].title}}</span>
|
|
113 |
<span *ngIf="!communities[this.communityIds[i]['zenodoid']].title">[no name available]</span>
|
|
104 | 114 |
</a> |
105 | 115 |
</h4> |
106 | 116 |
<div class="uk-comment-meta "> |
107 |
last update: {{item.date | date:'yyyy/MM/dd'}}
|
|
117 |
last update: {{communities[this.communityIds[i]['zenodoid']].date | date:'yyyy/MM/dd'}}
|
|
108 | 118 |
</div> |
109 | 119 |
</div> |
110 | 120 |
<!-- <div>--> |
111 |
<!-- <a class="uk-button portal-button" target="_blank" [href]="depositLink + item.id " >-->
|
|
121 |
<!-- <a class="uk-button portal-button" target="_blank" [href]="depositLink + communities[this.communityIds[i]['zenodoid']].id " >-->
|
|
112 | 122 |
<!-- <span class="uk-icon"> <svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="upload" ratio="1"><polyline fill="none" stroke="#000" points="5 8 9.5 3.5 14 8 "></polyline><rect x="3" y="17" width="13" height="1"></rect><line fill="none" stroke="#000" x1="9.5" y1="15" x2="9.5" y2="4"></line></svg></span>--> |
113 | 123 |
<!-- <span> New upload</span>--> |
114 | 124 |
|
115 | 125 |
<!-- </a>--> |
116 | 126 |
<!-- </div>--> |
117 | 127 |
<span class="uk-width-expand uk-flex uk-flex-bottom uk-flex-right"> |
118 |
<a [href]="depositLink + item.id " target="_blank" type="submit"
|
|
128 |
<a [href]="depositLink + communities[this.communityIds[i]['zenodoid']].id " target="_blank" type="submit"
|
|
119 | 129 |
class=" zenodoButton uk-float-right uk-button portal-button uk-padding uk-padding-remove-vertical uk-margin-small-left"> |
120 | 130 |
<span><span>New upload</span><span uk-icon="arrow-right"></span></span> |
121 | 131 |
</a> |
122 | 132 |
</span> |
123 | 133 |
</div> |
124 | 134 |
<div class="uk-comment-body uk-overflow-auto uk-height-max-medium uk-padding uk-padding-remove-vertical"> |
125 |
<p *ngIf="item.description" [innerHtml]=item.description></p> |
|
135 |
<p *ngIf="communities[this.communityIds[i]['zenodoid']].description" |
|
136 |
[innerHtml]="communities[this.communityIds[i]['zenodoid']].description"></p> |
|
126 | 137 |
</div> |
127 | 138 |
</div> |
128 | 139 |
</li> |
140 |
</ng-template> |
|
129 | 141 |
</ul> |
130 | 142 |
</div> |
131 | 143 |
<helper *ngIf="pageContents && pageContents['bottom'] && pageContents['bottom'].length > 0" |
modules/uoa-connect-portal/trunk/src/app/deposit/zenodo/shareInZenodo.component.ts | ||
---|---|---|
45 | 45 |
|
46 | 46 |
communityIds = null; |
47 | 47 |
communities = []; |
48 |
|
|
48 |
page = 1; |
|
49 |
size = 5; |
|
49 | 50 |
zenodoCommunitiesLoadedCount = 0; |
50 | 51 |
zenodoSearchUtils: SearchUtilsClass = new SearchUtilsClass(); |
51 | 52 |
errorCodes: ErrorCodes = new ErrorCodes(); |
... | ... | |
125 | 126 |
if (this.communityIds.length == 0) { |
126 | 127 |
this.zenodoSearchUtils.status = this.errorCodes.NONE; |
127 | 128 |
} |
128 |
for (let i = 0; i < this.communityIds.length; i++) { |
|
129 |
this.getZenodoCommunityById(this.communityIds[i]["zenodoid"], this.communityIds[i]["id"]); |
|
130 |
} |
|
129 |
this.getCommunities() |
|
131 | 130 |
|
132 | 131 |
}, |
133 | 132 |
error => { |
... | ... | |
186 | 185 |
getZenodoCommunityById(zenodoid, openaireId) { |
187 | 186 |
this.subs.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities + zenodoid, openaireId).subscribe( |
188 | 187 |
result => { |
189 |
this.communities.push(result);
|
|
188 |
this.communities[zenodoid] = result;
|
|
190 | 189 |
this.zenodoCommunitiesLoadedCount++; |
191 |
if (this.zenodoCommunitiesLoadedCount >= this.communityIds.length) { |
|
190 |
if (this.zenodoCommunitiesLoadedCount >= this.communityIds.length || this.page * this.size) {
|
|
192 | 191 |
this.zenodoSearchUtils.status = this.errorCodes.DONE; |
193 | 192 |
} |
194 | 193 |
|
... | ... | |
214 | 213 |
private handleError(message: string, error) { |
215 | 214 |
console.error("Share in Zenodo Page: " + message, error); |
216 | 215 |
} |
216 |
public getCommunities($event = {value:1}) { |
|
217 |
this.page = $event.value; |
|
218 |
for (let i = (this.page - 1 ) * this.size; i < this.communityIds.length && i< this.page * this.size; i++) { |
|
219 |
if(!this.communities[this.communityIds[i]["zenodoid"]]) { |
|
220 |
this.getZenodoCommunityById(this.communityIds[i]["zenodoid"], this.communityIds[i]["id"]); |
|
221 |
} |
|
222 |
} |
|
223 |
} |
|
224 |
|
|
217 | 225 |
} |
Also available in: Unified diff
[Connect|Trunk]
Zenodo communities: paging for zenodo communites