Connect: Add new functionality dont show message again on modal.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@56809 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-07-30 13:27:12 +00:00
parent 228009bb34
commit c84983ab1b
2 changed files with 92 additions and 43 deletions

View File

@ -8,7 +8,23 @@
<span>Subscribed</span>
</div>
<div class="uk-card-media-top uk-padding uk-padding-remove-vertical uk-flex uk-flex-center uk-flex-middle">
<a (click)="confirmModalOpen()">
<a *ngIf="directLink" [href]="getCommunityPageUrl()" target="_blank">
<div class="community">
<img *ngIf="community.logoUrl != null && community.logoUrl != ''" src="{{community.logoUrl}}"
alt="{{(community.title)?community.title:community.shortTitle}} logo">
<span *ngIf="community.logoUrl == null || community.logoUrl == ''" class="uk-icon">
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none" stroke="#000"
stroke-width="1.1" cx="7.7"
cy="8.6" r="3.5"></circle> <path
fill="none" stroke="#000" stroke-width="1.1"
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path> <path fill="none"
stroke="#000"
stroke-width="1.1"
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg>
</span>
</div>
</a>
<a *ngIf="!directLink" (click)="confirmModalOpen()">
<div class="community">
<img *ngIf="community.logoUrl != null && community.logoUrl != ''" src="{{community.logoUrl}}"
alt="{{(community.title)?community.title:community.shortTitle}} logo">
@ -27,7 +43,17 @@
</div>
<div class="uk-card-body uk-padding-remove-horizontal uk-padding-remove-top uk-margin-small-top community">
<div class="uk-text-center uk-text-bold " [ngClass]="(showDescription)?'uk-margin-bottom':''">
<a (click)="confirmModalOpen()">
<a *ngIf="directLink" [href]="getCommunityPageUrl()" target="_blank">
<span *ngIf="community.title">
{{community.title.slice(0, thresholdTitle)}}
<span *ngIf="community.title.length > thresholdTitle">...</span>
</span>
<span *ngIf="!community.title && community.shortTitle">
{{community.shortTitle.slice(0, thresholdTitle)}}
<span *ngIf="community.shortTitle.length > thresholdTitle">...</span>
</span>
</a>
<a *ngIf="!directLink" (click)="confirmModalOpen()">
<span *ngIf="community.title">
{{community.title.slice(0, thresholdTitle)}}
<span *ngIf="community.title.length > thresholdTitle">...</span>
@ -53,8 +79,7 @@
</div>
</div>
<modal-alert #AlertModal (alertOutput)="goToCommunityPage($event)">
<div class="uk-text-center">
The profile will be presented in a new tab.<br>
Are you sure that you want to proceed?
<div class="uk-text-left">
You will be navigated to a new tab. Are you sure that you want to proceed?
</div>
</modal-alert>

View File

@ -1,16 +1,14 @@
import {Component, Input, Output, EventEmitter} from '@angular/core';
import {ViewChild, ChangeDetectionStrategy} from '@angular/core';
import {ViewEncapsulation} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common';
import {Component, Input, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Location} from '@angular/common';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
import {LocalStorageService} from "../../openaireLibrary/services/localStorage.service";
@Component({
selector: 'browse-community',
templateUrl: 'browse-community.component.html'
selector: 'browse-community',
templateUrl: 'browse-community.component.html'
})
export class BrowseCommunityComponent {
@ -23,48 +21,74 @@ export class BrowseCommunityComponent {
// check title length, if is manager, if is private and cut description accordingly
public thresholdTitle: number = 50;
public thresholdDescription: number = 120;
properties:EnvProperties;
properties: EnvProperties;
public directLink: boolean = true;
constructor ( private route: ActivatedRoute,
private router: Router,
private location: Location) {}
constructor(private route: ActivatedRoute,
private router: Router,
private location: Location,
private localStorageService: LocalStorageService) {
}
public ngOnInit() {
this.route.data
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
});
.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.localStorageService.get().subscribe(value => {
this.directLink = value;
});
});
}
public ngOnDestroy() {}
isProduction():boolean{
return this.properties.environment!="development";
public ngOnDestroy() {
}
getProductionPrefix():string{
return (this.properties.environment =="beta")?"beta.":""
isProduction(): boolean {
return this.properties.environment != "development";
}
getProductionPrefix(): string {
return (this.properties.environment == "beta") ? "beta." : ""
}
public confirmModalOpen() {
this.modal.cancelButton = true;
this.modal.okButton = true;
this.modal.alertTitle = 'You have selected ' + this.community.title;
this.modal.alertMessage = false;
this.modal.okButtonLeft = false;
this.modal.okButtonText = 'Yes';
this.modal.cancelButtonText = 'No';
this.modal.open();
this.modal.cancelButton = true;
this.modal.okButton = true;
this.modal.alertTitle = 'You are going to visit ' +
((this.community.title) ? this.community.title : this.community.shortTitle);
this.modal.alertMessage = false;
this.modal.okButtonLeft = false;
this.modal.okButtonText = 'Yes';
this.modal.cancelButtonText = 'No';
this.modal.choice = true;
this.modal.open();
}
public getCommunityPageUrl(): string {
let url = '';
if (this.isProduction()) {
url = 'https://' + this.getProductionPrefix() + this.community.communityId + '.openaire.eu';
} else {
url = this.router.createUrlTree(['/'], {
queryParams: {'communityId': this.community.communityId}
}).toString();
}
return url;
}
public goToCommunityPage(data: any) {
let url = '';
if(this.isProduction()) {
url = 'https://'+ this.getProductionPrefix() + this.community.communityId +'.openaire.eu';
} else {
url = this.router.createUrlTree(['/'], {
queryParams: { 'communityId': this.community.communityId} }).toString();
if (data.value == true) {
this.localStorageService.setCommunityDirectLink(data.choice);
let url = '';
if (this.isProduction()) {
url = 'https://' + this.getProductionPrefix() + this.community.communityId + '.openaire.eu';
} else {
url = this.router.createUrlTree(['/'], {
queryParams: {'communityId': this.community.communityId}
}).toString();
}
window.open(url, '_blank');
}
window.open(url, '_blank');
}
}