mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-14 13:33:03 +00:00
Added unsubscribe to community logo subscription.
This commit is contained in:
@@ -22,11 +22,11 @@
|
|||||||
<!-- Copyright -->
|
<!-- Copyright -->
|
||||||
<ds-comcol-page-content
|
<ds-comcol-page-content
|
||||||
[content]="(collectionData.payload | async)?.copyrightText"
|
[content]="(collectionData.payload | async)?.copyrightText"
|
||||||
[hasInnerHtml]="true">>
|
[hasInnerHtml]="true">
|
||||||
</ds-comcol-page-content>
|
</ds-comcol-page-content>
|
||||||
<!-- Licence -->
|
<!-- Licence -->
|
||||||
<ds-comcol-page-content
|
<ds-comcol-page-content
|
||||||
[content]="(collectionData.payload | async)?.license"
|
[content]="(collectionData.payload | async)?.license"
|
||||||
[title]="'collection.page.license'">>
|
[title]="'collection.page.license'">
|
||||||
</ds-comcol-page-content>
|
</ds-comcol-page-content>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
[content]="(communityData.payload | async)?.sidebarText"
|
[content]="(communityData.payload | async)?.sidebarText"
|
||||||
[hasInnerHtml]="true"
|
[hasInnerHtml]="true"
|
||||||
[title]="'community.page.news'">
|
[title]="'community.page.news'">
|
||||||
</ds-comcol-page-content >
|
</ds-comcol-page-content>
|
||||||
<!-- Copyright -->
|
<!-- Copyright -->
|
||||||
<ds-comcol-page-content
|
<ds-comcol-page-content
|
||||||
[content]="(communityData.payload | async)?.copyrightText"
|
[content]="(communityData.payload | async)?.copyrightText"
|
||||||
|
@@ -1,19 +1,21 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, Params } from '@angular/router';
|
import { ActivatedRoute, Params } from '@angular/router';
|
||||||
|
|
||||||
import { Community } from "../core/shared/community.model";
|
import { Community } from "../core/shared/community.model";
|
||||||
import { Bitstream } from "../core/shared/bitstream.model";
|
import { Bitstream } from "../core/shared/bitstream.model";
|
||||||
import { RemoteData } from "../core/data/remote-data";
|
import { RemoteData } from "../core/data/remote-data";
|
||||||
import { CommunityDataService } from "../core/data/community-data.service";
|
import { CommunityDataService } from "../core/data/community-data.service";
|
||||||
|
import { Subscription } from "rxjs/Subscription";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-community-page',
|
selector: 'ds-community-page',
|
||||||
styleUrls: ['./community-page.component.css'],
|
styleUrls: ['./community-page.component.css'],
|
||||||
templateUrl: './community-page.component.html',
|
templateUrl: './community-page.component.html',
|
||||||
})
|
})
|
||||||
export class CommunityPageComponent implements OnInit {
|
export class CommunityPageComponent implements OnInit, OnDestroy {
|
||||||
communityData: RemoteData<Community>;
|
communityData: RemoteData<Community>;
|
||||||
logoData: RemoteData<Bitstream>;
|
logoData: RemoteData<Bitstream>;
|
||||||
|
private subs: Subscription[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private communityDataService: CommunityDataService,
|
private communityDataService: CommunityDataService,
|
||||||
@@ -24,12 +26,16 @@ export class CommunityPageComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.route.params.subscribe((params: Params) => {
|
this.route.params.subscribe((params: Params) => {
|
||||||
this.communityData = this.communityDataService.findById(params['id'])
|
this.communityData = this.communityDataService.findById(params['id']);
|
||||||
this.communityData.payload
|
this.subs.push(this.communityData.payload
|
||||||
.subscribe(community => this.logoData = community.logo);
|
.subscribe(community => this.logoData = community.logo));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnDestroy(): void {
|
||||||
|
this.subs.forEach(sub => sub.unsubscribe());
|
||||||
|
}
|
||||||
|
|
||||||
universalInit() {
|
universalInit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
export const COMMUNITIES = [
|
export const COMMUNITIES = {
|
||||||
|
"communities": [
|
||||||
{
|
{
|
||||||
"name": "Community 1",
|
"name": "Community 1",
|
||||||
"handle": "10673/1",
|
"handle": "10673/1",
|
||||||
@@ -84,4 +85,5 @@ export const COMMUNITIES = [
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
]
|
||||||
|
};
|
Reference in New Issue
Block a user