resultLanding: display community categories and concepts only when on browsing that community
This commit is contained in:
parent
55f7167fb4
commit
de6c91cbab
|
@ -6,7 +6,7 @@ export class ConnectHelper {
|
||||||
|
|
||||||
public static getCommunityFromDomain(domain: string): string{
|
public static getCommunityFromDomain(domain: string): string{
|
||||||
if(properties.environment == "development") {
|
if(properties.environment == "development") {
|
||||||
domain = "beta.connect.openaire.eu"; //for testing
|
domain = "aginfra.openaire.eu"; //for testing
|
||||||
}
|
}
|
||||||
domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix
|
domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix
|
||||||
if (domain.indexOf('openaire.eu') === -1) {
|
if (domain.indexOf('openaire.eu') === -1) {
|
||||||
|
@ -49,6 +49,6 @@ export class ConnectHelper {
|
||||||
|
|
||||||
|
|
||||||
public static isPrivate(community, user) {
|
public static isPrivate(community, user) {
|
||||||
return community && (community.status == "hidden" || (community.status == "manager" && !(Session.isCommunityCurator(user) || Session.isManager("community", community.communityId, user))))
|
return community && (community.status == "hidden" || (community.status == "manager" && !(Session.isPortalAdministrator(user) || Session.isCommunityCurator(user) || Session.isManager("community", community.communityId, user))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,16 +39,19 @@ import {HelperFunctions} from "../../utils/HelperFunctions.class";
|
||||||
<div>
|
<div>
|
||||||
<div *ngIf="gateways && gateways.length > 0" class="uk-text-muted">Other Communities</div>
|
<div *ngIf="gateways && gateways.length > 0" class="uk-text-muted">Other Communities</div>
|
||||||
<ul class="custom-list" [ngClass]="{'uk-padding-remove uk-margin-remove': !gateways || gateways.length == 0}">
|
<ul class="custom-list" [ngClass]="{'uk-padding-remove uk-margin-remove': !gateways || gateways.length == 0}">
|
||||||
<li *ngFor="let community of otherCommunities">
|
<li *ngFor="let community of otherCommunities; let i = index">
|
||||||
{{community.labelContext}}
|
{{community.labelContext}}
|
||||||
|
<span *ngIf="community.labelCategory && (currentCommunity == community.idContext)">
|
||||||
|
<span uk-icon="icon: arrow-right"></span> {{community.labelCategory}}
|
||||||
|
</span>
|
||||||
|
<span *ngIf="community.labelConcept && (currentCommunity == community.idContext)">
|
||||||
|
: {{community.labelConcept}}
|
||||||
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
<!-- TODO: Connect relatedTo component with concepts this time -->
|
|
||||||
|
|
||||||
<!-- <ng-container *ngIf="connectLinksView; else elseBlock"> -->
|
<!-- <ng-container *ngIf="connectLinksView; else elseBlock"> -->
|
||||||
<!-- One gateway link -->
|
<!-- One gateway link -->
|
||||||
<!-- <div *ngIf="gateways && gateways.length === 1" class="uk-margin-medium-top uk-width-1-2@m">
|
<!-- <div *ngIf="gateways && gateways.length === 1" class="uk-margin-medium-top uk-width-1-2@m">
|
||||||
|
@ -157,6 +160,7 @@ export class RelatedToComponent implements OnInit {
|
||||||
public showNum: number = 5;
|
public showNum: number = 5;
|
||||||
public gateways = [];
|
public gateways = [];
|
||||||
public otherCommunities = [];
|
public otherCommunities = [];
|
||||||
|
public currentCommunity = ConnectHelper.getCommunityFromDomain(properties.domain);
|
||||||
private subscriptions = [];
|
private subscriptions = [];
|
||||||
|
|
||||||
constructor(private communityService: CommunityService,
|
constructor(private communityService: CommunityService,
|
||||||
|
@ -174,7 +178,7 @@ export class RelatedToComponent implements OnInit {
|
||||||
//- handling subscribe errors?
|
//- handling subscribe errors?
|
||||||
this.subscriptions.push(
|
this.subscriptions.push(
|
||||||
this.communityService.getCommunity(context.idContext).subscribe( community => {
|
this.communityService.getCommunity(context.idContext).subscribe( community => {
|
||||||
if(community && !ConnectHelper.isPrivate(community,user) && (ConnectHelper.getCommunityFromDomain(properties.domain) != context.idContext)) {
|
if(community && !ConnectHelper.isPrivate(community,user) && (this.currentCommunity != context.idContext)) {
|
||||||
// creating the link, based on the enviroment
|
// creating the link, based on the enviroment
|
||||||
let url = '';
|
let url = '';
|
||||||
if(properties.environment == "beta") {
|
if(properties.environment == "beta") {
|
||||||
|
@ -190,12 +194,14 @@ export class RelatedToComponent implements OnInit {
|
||||||
}
|
}
|
||||||
this.gateways.push(context);
|
this.gateways.push(context);
|
||||||
} else {
|
} else {
|
||||||
for(let other of this.otherCommunities) {
|
if(this.currentCommunity != context.idContext) {
|
||||||
if(other.idContext == context.idContext) {
|
for(let other of this.otherCommunities) {
|
||||||
return; // skips so that we don't get duplicate communities because of the multiple concepts
|
if(other.idContext == context.idContext) {
|
||||||
|
return; // skips so that we don't get duplicate communities because of the multiple concepts
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.otherCommunities.push(context)
|
this.otherCommunities.push(context);
|
||||||
}
|
}
|
||||||
index++;
|
index++;
|
||||||
if(index == this.contexts.length) {
|
if(index == this.contexts.length) {
|
||||||
|
|
Loading…
Reference in New Issue