[Trunk | Admin]:

1. help-content.service: Add "getPageByRoute()" method (used by affiliations.component).
2. affiliations.component.ts: Call "getPageByRoute()" to get id of "/organizations" page.
3. affiliations.component.html: In "Related Organizations" page, add link to "/classContents" page for organizations.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@56403 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-07-08 13:09:45 +00:00
parent 2621817e70
commit 3ae34beee5
3 changed files with 35 additions and 1 deletions

View File

@ -21,6 +21,16 @@
<span *ngIf="!curatorAffiliations">Add new Organization</span>
</button>
</div>
<div *ngIf="!curatorAffiliations && organizationsPageId" class="uk-width-1-1 uk-margin">
Do you need to add more information about the Related Organizations? Click
<!-- classContentId: ,-->
<!-- /edit-->
<a [queryParams]="{communityId: communityId, pageId: organizationsPageId}" routerLink="/classContents"
routerLinkActive="router-link-active">
here
</a>
</div>
</div>
<ul [class]="'uk-list uk-list-divider uk-margin' + (curatorAffiliations ? ' uk-height-max-large uk-overflow-auto' : '')"

View File

@ -10,6 +10,7 @@ import {HelperFunctions} from '../../openaireLibrary/utils/HelperFunctions.class
import {AlertModal} from '../../openaireLibrary/utils/modal/alert';
import {UtilitiesService} from '../../openaireLibrary/services/utilities.service';
import {AffiliationService} from "../../openaireLibrary/connect/affiliations/affiliation.service";
import {HelpContentService} from "../../services/help-content.service";
@Component({
selector: 'affiliations',
@ -36,11 +37,13 @@ export class AffiliationsComponent implements OnInit {
@Output() affiliationsChange: EventEmitter<boolean> = new EventEmitter();
@Output() resetCuratorMessages: EventEmitter<boolean> = new EventEmitter();
public communityId: string;
public organizationsPageId: string;
constructor(private element: ElementRef,
private route: ActivatedRoute,
private _router: Router,
private affiliationService: AffiliationService,
private _helpContentService: HelpContentService,
private utilitiesService: UtilitiesService) {
}
@ -74,7 +77,8 @@ export class AffiliationsComponent implements OnInit {
this.affiliationService.affiliations.subscribe(
affiliations => {
this.affiliations = affiliations;
this.showLoading = false;
this.getOrganizationsPageId();
//this.showLoading = false;
},
error => {
console.error("Affiliations Component: Error getting affiliations for community with id: "+this.communityId, error);
@ -83,6 +87,21 @@ export class AffiliationsComponent implements OnInit {
);
}
getOrganizationsPageId() {
this._helpContentService.getPageByRoute("/organizations", this.properties.adminToolsAPIURL).subscribe(
pages => {
if(pages && pages[0]) {
this.organizationsPageId = pages[0]._id;
}
this.showLoading = false;
},
error => {
console.error("Affiliations Component: Error getting page with route '/organizations' for community with id: "+this.communityId, error);
this.showLoading = false;
}
);
}
initAffiliation(affiliation: Affiliation = null) {
this.resetMessages();

View File

@ -138,6 +138,11 @@ export class HelpContentService {
.pipe(catchError(this.handleError));
}
getPageByRoute(route:string, helpContentUrl:string) {
return this.http.get<Page>(helpContentUrl + 'page/?page_route='+route)
.pipe(catchError(this.handleError));
}
getCommunities( helpContentUrl:string) {
return this.http.get<Array<Community>>(helpContentUrl + 'community')
//.map(res => <Array<Community>> res.json())