Revision 56808
Added by Konstantinos Triantafyllou almost 5 years ago
modules/uoa-services-library/trunk/ng-openaire-library/src/app/services/localStorage.service.ts | ||
---|---|---|
1 |
import {Inject, Injectable, PLATFORM_ID} from "@angular/core"; |
|
2 |
import {BehaviorSubject, Observable} from "rxjs"; |
|
3 |
import {isPlatformBrowser} from "@angular/common"; |
|
4 |
|
|
5 |
@Injectable({ |
|
6 |
providedIn: "root" |
|
7 |
}) |
|
8 |
export class LocalStorageService { |
|
9 |
|
|
10 |
private communityDirectLink: BehaviorSubject<boolean>; |
|
11 |
|
|
12 |
constructor(@Inject(PLATFORM_ID) private platformId: string) { |
|
13 |
if(isPlatformBrowser(this.platformId)) { |
|
14 |
let item = localStorage.getItem('communityDirectLink'); |
|
15 |
if(item !== null) { |
|
16 |
this.communityDirectLink = new BehaviorSubject<boolean>(item == 'true'); |
|
17 |
} else { |
|
18 |
this.communityDirectLink = new BehaviorSubject<boolean>(false); |
|
19 |
} |
|
20 |
} else this.communityDirectLink = new BehaviorSubject<boolean>(true); |
|
21 |
} |
|
22 |
|
|
23 |
public setCommunityDirectLink(value: string) { |
|
24 |
localStorage.setItem('communityDirectLink', value); |
|
25 |
this.communityDirectLink.next(Boolean(value).valueOf()); |
|
26 |
} |
|
27 |
|
|
28 |
public get(): Observable<boolean> { |
|
29 |
console.log(this.communityDirectLink.getValue()); |
|
30 |
return this.communityDirectLink.asObservable(); |
|
31 |
} |
|
32 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/communitySearchResults.component.html | ||
---|---|---|
1 | 1 |
<ul [class]="'uk-list uk-list-divider uk-margin ' + custom_class"> |
2 |
<errorMessages [status]="[status]" [type]="'results'"></errorMessages>
|
|
2 |
<errorMessages [status]="[status]" [type]="'results'"></errorMessages> |
|
3 | 3 |
|
4 |
<li *ngFor="let result of results" class="uk-animation-fade uk-margin-auto" uk-grid> |
|
5 |
<a class="uk-width-1-5 uk-height-small uk-card uk-card-default uk-card-small communityCard uk-padding-remove-horizontal uk-inline" (click)="confirmModalOpen(result)"> |
|
6 |
<div *ngIf="result.isSubscribed" class="uk-position-top-right uk-card-badge portal-card-badge uk-width-1-2 uk-text-small uk-text-center"> |
|
7 |
<span>Subscribed</span> |
|
8 |
</div> |
|
9 |
<div class="uk-card-body uk-position-center uk-flex uk-flex-middle uk-flex-center"> |
|
10 |
<img *ngIf= "result.logoUrl != null && result.logoUrl != '' " src="{{result.logoUrl}}" alt="{{(result.title)?result.title:result.shortTitle}} logo" > |
|
11 |
<span *ngIf= "result.logoUrl == null || result.logoUrl == '' " class="uk-icon"> |
|
12 |
<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> |
|
4 |
<li *ngFor="let result of results" class="uk-animation-fade uk-margin-auto" uk-grid> |
|
5 |
<a *ngIf="directLink" [href]="getCommunityPageUrl(result.communityId)" target="_blank" |
|
6 |
class="uk-width-1-5 uk-height-small uk-card uk-card-default uk-card-small communityCard uk-padding-remove-horizontal uk-inline"> |
|
7 |
<div *ngIf="result.isSubscribed" |
|
8 |
class="uk-position-top-right uk-card-badge portal-card-badge uk-width-1-2 uk-text-small uk-text-center"> |
|
9 |
<span>Subscribed</span> |
|
10 |
</div> |
|
11 |
<div class="uk-card-body uk-position-center uk-flex uk-flex-middle uk-flex-center"> |
|
12 |
<img *ngIf="result.logoUrl != null && result.logoUrl != '' " src="{{result.logoUrl}}" |
|
13 |
alt="{{(result.title)?result.title:result.shortTitle}} logo"> |
|
14 |
<span *ngIf="result.logoUrl == null || result.logoUrl == '' " class="uk-icon"> |
|
15 |
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none" |
|
16 |
stroke="#000" |
|
17 |
stroke-width="1.1" |
|
18 |
cx="7.7" cy="8.6" |
|
19 |
r="3.5"></circle> <path |
|
20 |
fill="none" stroke="#000" stroke-width="1.1" |
|
21 |
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" |
|
22 |
stroke="#000" |
|
23 |
stroke-width="1.1" |
|
24 |
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> |
|
13 | 25 |
</span> |
14 |
</div> |
|
15 |
<div *ngIf="result.status == 'manager'" class="uk-card-badge private-card-badge uk-width-2-5 uk-position-top-left uk-text-small uk-text-center "> |
|
16 |
<span class="uk-padding-small">Private</span> |
|
17 |
</div> |
|
26 |
</div> |
|
27 |
<div *ngIf="result.status == 'manager'" |
|
28 |
class="uk-card-badge private-card-badge uk-width-2-5 uk-position-top-left uk-text-small uk-text-center "> |
|
29 |
<span class="uk-padding-small">Private</span> |
|
30 |
</div> |
|
31 |
</a> |
|
32 |
<a *ngIf="!directLink" |
|
33 |
class="uk-width-1-5 uk-height-small uk-card uk-card-default uk-card-small communityCard uk-padding-remove-horizontal uk-inline" |
|
34 |
(click)="confirmModalOpen(result)"> |
|
35 |
<div *ngIf="result.isSubscribed" |
|
36 |
class="uk-position-top-right uk-card-badge portal-card-badge uk-width-1-2 uk-text-small uk-text-center"> |
|
37 |
<span>Subscribed</span> |
|
38 |
</div> |
|
39 |
<div class="uk-card-body uk-position-center uk-flex uk-flex-middle uk-flex-center"> |
|
40 |
<img *ngIf="result.logoUrl != null && result.logoUrl != '' " src="{{result.logoUrl}}" |
|
41 |
alt="{{(result.title)?result.title:result.shortTitle}} logo"> |
|
42 |
<span *ngIf="result.logoUrl == null || result.logoUrl == '' " class="uk-icon"> |
|
43 |
<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="2.5"> <circle fill="none" |
|
44 |
stroke="#000" |
|
45 |
stroke-width="1.1" |
|
46 |
cx="7.7" cy="8.6" |
|
47 |
r="3.5"></circle> <path |
|
48 |
fill="none" stroke="#000" stroke-width="1.1" |
|
49 |
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" |
|
50 |
stroke="#000" |
|
51 |
stroke-width="1.1" |
|
52 |
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> |
|
53 |
</span> |
|
54 |
</div> |
|
55 |
<div *ngIf="result.status == 'manager'" |
|
56 |
class="uk-card-badge private-card-badge uk-width-2-5 uk-position-top-left uk-text-small uk-text-center "> |
|
57 |
<span class="uk-padding-small">Private</span> |
|
58 |
</div> |
|
59 |
</a> |
|
60 |
<div class="uk-width-expand"> |
|
61 |
<div [title]=result.shortTitle class="uk-text-large uk-grid"> |
|
62 |
<a *ngIf="directLink" [href]="getCommunityPageUrl(result.communityId)" target="_blank" |
|
63 |
[class]="(result.isManager)?'uk-width-3-4':''"> |
|
64 |
{{(result.title) ? result.title : result.shortTitle}} |
|
18 | 65 |
</a> |
19 |
<div class="uk-width-expand"> |
|
20 |
<div [title] = result.shortTitle class="uk-text-large uk-grid"> |
|
21 |
<a (click)="confirmModalOpen(result)" [class]="(result.isManager)?'uk-width-3-4':''"> |
|
22 |
{{(result.title)?result.title:result.shortTitle}} |
|
23 |
</a> |
|
24 |
<manage *ngIf="result.isManager" [communityId]="result.communityId" class="uk-width-expand uk-margin-auto-right"></manage> |
|
25 |
</div> |
|
26 |
<div *ngIf="result.description"> |
|
27 |
<div class="text-justify descriptionText uk-margin-auto-right" [title]="result.description"> |
|
28 |
{{_formatDescription(result.description)}} |
|
29 |
</div> |
|
30 |
</div> |
|
31 |
<div class="uk-padding-small uk-padding-remove-left uk-grid"> |
|
32 |
<div class="uk-width-1-2"> |
|
33 |
<span *ngIf="result.date"><b> Creation Date: </b></span> |
|
34 |
<span *ngIf="result.date">{{result.date | date:'dd-MM-yyyy'}}</span> |
|
35 |
</div> |
|
36 |
<div class="uk-width-expand uk-align-right uk-margin-auto-right"> |
|
37 |
<span *ngIf="result.type && result.type != ''" ><b> Type: </b></span> |
|
38 |
<span *ngIf="result.type && result.type != ''" >{{(result.type == 'ri')?'Research Initiative':'Research Community'}}</span> |
|
39 |
</div> |
|
40 |
</div> |
|
66 |
<a *ngIf="!directLink" (click)="confirmModalOpen(result)" [class]="(result.isManager)?'uk-width-3-4':''"> |
|
67 |
{{(result.title) ? result.title : result.shortTitle}} |
|
68 |
</a> |
|
69 |
<manage *ngIf="result.isManager" [communityId]="result.communityId" |
|
70 |
class="uk-width-expand uk-margin-auto-right"></manage> |
|
71 |
</div> |
|
72 |
<div *ngIf="result.description"> |
|
73 |
<div class="text-justify descriptionText uk-margin-auto-right" [title]="result.description"> |
|
74 |
{{_formatDescription(result.description)}} |
|
41 | 75 |
</div> |
42 |
</li> |
|
76 |
</div> |
|
77 |
<div class="uk-padding-small uk-padding-remove-left uk-grid"> |
|
78 |
<div class="uk-width-1-2"> |
|
79 |
<span *ngIf="result.date"><b> Creation Date: </b></span> |
|
80 |
<span *ngIf="result.date">{{result.date | date:'dd-MM-yyyy'}}</span> |
|
81 |
</div> |
|
82 |
<div class="uk-width-expand uk-align-right uk-margin-auto-right"> |
|
83 |
<span *ngIf="result.type && result.type != ''"><b> Type: </b></span> |
|
84 |
<span |
|
85 |
*ngIf="result.type && result.type != ''">{{(result.type == 'ri') ? 'Research Initiative' : 'Research Community'}}</span> |
|
86 |
</div> |
|
87 |
</div> |
|
88 |
</div> |
|
89 |
</li> |
|
43 | 90 |
</ul> |
44 | 91 |
<modal-alert #AlertModal (alertOutput)="goToCommunityPage($event)"> |
45 |
<div class="uk-text-center"> |
|
46 |
The profile will be presented in a new tab.<br> |
|
47 |
Are you sure that you want to proceed? |
|
48 |
</div> |
|
92 |
<div class="uk-text-left"> |
|
93 |
You will be navigated to a new tab. Are you sure that you want to proceed? |
|
94 |
</div> |
|
49 | 95 |
</modal-alert> |
50 | 96 |
|
modules/uoa-services-library/trunk/ng-openaire-library/src/app/searchPages/searchUtils/communitySearchResults.component.ts | ||
---|---|---|
1 | 1 |
import {Component, Input, ViewChild} from '@angular/core'; |
2 | 2 |
import {ErrorCodes} from '../../utils/properties/errorCodes'; |
3 | 3 |
import {RouterHelper} from '../../utils/routerHelper.class'; |
4 |
import{EnvProperties} from '../../utils/properties/env-properties'; |
|
4 |
import {EnvProperties} from '../../utils/properties/env-properties';
|
|
5 | 5 |
import {CommunityInfo} from "../../connect/community/communityInfo"; |
6 | 6 |
import {Router} from "@angular/router"; |
7 |
import {LocalStorageService} from "../../services/localStorage.service"; |
|
8 |
|
|
7 | 9 |
@Component({ |
8 | 10 |
selector: 'community-search-result', |
9 |
templateUrl:'communitySearchResults.component.html' |
|
11 |
templateUrl: 'communitySearchResults.component.html'
|
|
10 | 12 |
}) |
11 | 13 |
|
12 | 14 |
export class CommunitySearchResultsComponent { |
... | ... | |
21 | 23 |
|
22 | 24 |
|
23 | 25 |
public urlParam: string; |
24 |
public errorCodes:ErrorCodes = new ErrorCodes(); |
|
25 |
public routerHelper:RouterHelper = new RouterHelper(); |
|
26 |
public errorCodes: ErrorCodes = new ErrorCodes();
|
|
27 |
public routerHelper: RouterHelper = new RouterHelper();
|
|
26 | 28 |
public errorMessage: string = "No results found"; |
27 | 29 |
public selectedCommunityId: string; |
28 |
constructor(private router: Router) {}
|
|
30 |
public directLink: boolean = true;
|
|
29 | 31 |
|
30 |
ngOnInit() { |
|
31 | 32 |
|
33 |
constructor(private router: Router, |
|
34 |
private localStorageService: LocalStorageService) { |
|
32 | 35 |
} |
33 | 36 |
|
34 |
getProductionPrefix():string{ |
|
35 |
return (this.properties.environment == "beta")?"beta.":"" |
|
37 |
ngOnInit() { |
|
38 |
this.localStorageService.get().subscribe(value => { |
|
39 |
this.directLink = value; |
|
40 |
}); |
|
36 | 41 |
} |
37 | 42 |
|
38 |
isProduction():boolean{ |
|
39 |
return this.properties.environment!="development"; |
|
43 |
getProductionPrefix(): string { |
|
44 |
return (this.properties.environment == "beta") ? "beta." : "" |
|
45 |
} |
|
40 | 46 |
|
47 |
isProduction(): boolean { |
|
48 |
return this.properties.environment != "development"; |
|
49 |
|
|
41 | 50 |
} |
42 | 51 |
|
43 |
public _formatDescription(description){ |
|
44 |
return (((description).length > this.maxCharacters)?(description.substring(0,(this.maxCharacters - ('...').length))+"..."):description);
|
|
52 |
public _formatDescription(description) {
|
|
53 |
return (((description).length > this.maxCharacters) ? (description.substring(0, (this.maxCharacters - ('...').length)) + "...") : description);
|
|
45 | 54 |
} |
46 | 55 |
|
47 | 56 |
public confirmModalOpen(community: CommunityInfo) { |
48 |
this.selectedCommunityId = community.communityId; |
|
49 |
this.modal.cancelButton = true; |
|
50 |
this.modal.okButton = true; |
|
51 |
this.modal.alertTitle = 'You have selected ' + community.title; |
|
52 |
this.modal.alertMessage = false; |
|
53 |
this.modal.okButtonLeft = false; |
|
54 |
this.modal.okButtonText = 'Yes'; |
|
55 |
this.modal.cancelButtonText = 'No'; |
|
56 |
this.modal.open(); |
|
57 |
this.modal.cancelButton = true; |
|
58 |
this.modal.okButton = true; |
|
59 |
this.modal.alertTitle = 'You are going to visit ' + |
|
60 |
((community.title) ? community.title : community.shortTitle); |
|
61 |
this.modal.alertMessage = false; |
|
62 |
this.modal.okButtonLeft = false; |
|
63 |
this.modal.okButtonText = 'Yes'; |
|
64 |
this.modal.cancelButtonText = 'No'; |
|
65 |
this.modal.choice = true; |
|
66 |
this.modal.open(); |
|
57 | 67 |
} |
58 | 68 |
|
59 |
public goToCommunityPage(data: any) {
|
|
69 |
public getCommunityPageUrl(communityId: string): string {
|
|
60 | 70 |
let url = ''; |
61 |
if(this.isProduction()) { |
|
62 |
url = 'https://'+ this.getProductionPrefix() + this.selectedCommunityId +'.openaire.eu';
|
|
71 |
if (this.isProduction()) {
|
|
72 |
url = 'https://' + this.getProductionPrefix() + communityId + '.openaire.eu';
|
|
63 | 73 |
} else { |
64 | 74 |
url = this.router.createUrlTree(['/'], { |
65 |
queryParams: { 'communityId': this.selectedCommunityId} }).toString(); |
|
75 |
queryParams: {'communityId': communityId} |
|
76 |
}).toString(); |
|
66 | 77 |
} |
67 |
window.open(url, '_blank');
|
|
78 |
return url;
|
|
68 | 79 |
} |
80 |
|
|
81 |
public goToCommunityPage(data: any) { |
|
82 |
if (data.value == true) { |
|
83 |
this.localStorageService.setCommunityDirectLink(data.choice); |
|
84 |
let url = ''; |
|
85 |
if (this.isProduction()) { |
|
86 |
url = 'https://' + this.getProductionPrefix() + this.selectedCommunityId + '.openaire.eu'; |
|
87 |
} else { |
|
88 |
url = this.router.createUrlTree(['/'], { |
|
89 |
queryParams: {'communityId': this.selectedCommunityId} |
|
90 |
}).toString(); |
|
91 |
} |
|
92 |
window.open(url, '_blank'); |
|
93 |
} |
|
94 |
} |
|
69 | 95 |
} |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/modal/alert.ts | ||
---|---|---|
3 | 3 |
@Component({ |
4 | 4 |
selector: 'modal-alert', |
5 | 5 |
template: ` |
6 |
<div [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open uk-animation-fade'" uk-modal [open]="!isOpen" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
|
7 |
<div class="uk-modal-dialog uk-modal-body" role=""> |
|
8 |
<div class="uk-modal-title" [hidden]=!alertHeader> |
|
9 |
<button class="uk-modal-close-default uk-float-right" (click)='cancel()' uk-close></button> |
|
10 |
<h4 class="modal-title text-center" id="myModalLabel">{{alertTitle}}</h4> |
|
6 |
<div [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open'" uk-modal [open]="!isOpen" id="myModal" |
|
7 |
tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> |
|
8 |
<div class="uk-modal-dialog uk-modal-body uk-animation-slide-bottom-small uk-text-left" role=""> |
|
9 |
<div class="uk-modal-title" [hidden]=!alertHeader> |
|
10 |
<button class="uk-modal-close-default uk-float-right" (click)='cancel()' uk-close></button> |
|
11 |
<h4 class="modal-title" id="myModalLabel">{{alertTitle}}</h4> |
|
11 | 12 |
</div> |
12 |
<div class="uk-margin ">
|
|
13 |
<div class="uk-margin"> |
|
13 | 14 |
<div [hidden]=!alertMessage> |
14 |
{{message}} |
|
15 |
{{message}}
|
|
15 | 16 |
</div> |
16 | 17 |
<ng-content></ng-content> |
17 | 18 |
</div> |
18 |
<div *ngIf="okButtonLeft" class="uk-text-right" [hidden]=!alertFooter> |
|
19 |
<span [hidden]=!okButton > |
|
20 |
<button class="uk-button uk-button-default" (click)="ok()">{{okButtonText}}</button> |
|
21 |
</span> |
|
22 |
<span [hidden]=!cancelButton> |
|
23 |
<button class="uk-button uk-button-default uk-margin-small-left" (click)="cancel()">{{cancelButtonText}}</button> |
|
24 |
</span> |
|
19 |
<div class="uk-grid uk-flex uk-flex-middle"> |
|
20 |
<label *ngIf="choice" class="uk-width-1-2 checkbox"> |
|
21 |
<input type="checkbox" [(ngModel)]="select"> |
|
22 |
<span class="uk-margin-small-left" style="font-weight: normal;">Don't show this message again</span> |
|
23 |
</label> |
|
24 |
<div [ngClass]="(choice)?'uk-width-1-2':'uk-width-1-1'"> |
|
25 |
<div *ngIf="okButtonLeft" class="uk-text-right" [hidden]=!alertFooter> |
|
26 |
<span [hidden]=!okButton> |
|
27 |
<button class="uk-button uk-button-default" (click)="ok()">{{okButtonText}}</button> |
|
28 |
</span> |
|
29 |
<span [hidden]=!cancelButton> |
|
30 |
<button class="uk-button uk-button-default uk-margin-small-left" |
|
31 |
(click)="cancel()">{{cancelButtonText}}</button> |
|
32 |
</span> |
|
33 |
</div> |
|
34 |
<div *ngIf="!okButtonLeft" class="uk-text-right" [hidden]=!alertFooter> |
|
35 |
<span [hidden]=!cancelButton> |
|
36 |
<button class="uk-button uk-button-default uk-margin-small-right" |
|
37 |
(click)="cancel()">{{cancelButtonText}}</button> |
|
38 |
</span> |
|
39 |
<span [hidden]=!okButton> |
|
40 |
<button *ngIf="okDisabled" class="uk-button uk-button-default" disabled>{{okButtonText}}</button> |
|
41 |
<button *ngIf="!okDisabled" class="uk-button portal-button" (click)="ok()">{{okButtonText}}</button> |
|
42 |
</span> |
|
43 |
</div> |
|
44 |
</div> |
|
25 | 45 |
</div> |
26 |
<div *ngIf="!okButtonLeft" class="uk-text-right" [hidden]=!alertFooter> |
|
27 |
<span [hidden]=!cancelButton> |
|
28 |
<button class="uk-button uk-button-default uk-margin-small-right" (click)="cancel()">{{cancelButtonText}}</button> |
|
29 |
</span> |
|
30 |
<span [hidden]=!okButton > |
|
31 |
<button *ngIf="okDisabled" class="uk-button uk-button-default" disabled>{{okButtonText}}</button> |
|
32 |
<button *ngIf="!okDisabled" class="uk-button portal-button" (click)="ok()">{{okButtonText}}</button> |
|
33 |
</span> |
|
34 |
</div> |
|
35 |
|
|
46 |
</div> |
|
36 | 47 |
</div> |
37 |
</div> |
|
38 |
|
|
39 |
|
|
40 | 48 |
`, |
41 | 49 |
encapsulation: ViewEncapsulation.None, |
42 | 50 |
}) |
43 | 51 |
/** |
44 |
* API to an open alert window.
|
|
45 |
*/
|
|
46 |
export class AlertModal{ |
|
52 |
* API to an open alert window. |
|
53 |
*/ |
|
54 |
export class AlertModal {
|
|
47 | 55 |
/** |
48 |
* Caption for the title.
|
|
49 |
*/
|
|
50 |
public alertTitle:string; |
|
56 |
* Caption for the title. |
|
57 |
*/ |
|
58 |
public alertTitle: string;
|
|
51 | 59 |
/** |
52 |
* Describes if the alert contains Ok Button.
|
|
53 |
* The default Ok button will close the alert and emit the callback.
|
|
54 |
* Defaults to true.
|
|
55 |
*/
|
|
56 |
public okButton:boolean = true; |
|
60 |
* Describes if the alert contains Ok Button. |
|
61 |
* The default Ok button will close the alert and emit the callback. |
|
62 |
* Defaults to true. |
|
63 |
*/ |
|
64 |
public okButton: boolean = true;
|
|
57 | 65 |
/** |
58 |
* Caption for the OK button.
|
|
59 |
* Default: Ok
|
|
60 |
*/
|
|
61 |
public okButtonText:string= 'Ok';
|
|
66 |
* Caption for the OK button. |
|
67 |
* Default: Ok |
|
68 |
*/ |
|
69 |
public okButtonText: string = 'Ok';
|
|
62 | 70 |
/** |
63 |
* Describes if the alert contains cancel Button.
|
|
64 |
* The default Cancelbutton will close the alert.
|
|
65 |
* Defaults to true.
|
|
66 |
*/
|
|
67 |
public cancelButton:boolean = true; |
|
71 |
* Describes if the alert contains cancel Button. |
|
72 |
* The default Cancelbutton will close the alert. |
|
73 |
* Defaults to true. |
|
74 |
*/ |
|
75 |
public cancelButton: boolean = true;
|
|
68 | 76 |
/** |
69 |
* Caption for the Cancel button.
|
|
70 |
* Default: Cancel
|
|
71 |
*/
|
|
72 |
public cancelButtonText:string = 'Cancel'; |
|
77 |
* Caption for the Cancel button. |
|
78 |
* Default: Cancel |
|
79 |
*/ |
|
80 |
public cancelButtonText: string = 'Cancel';
|
|
73 | 81 |
/** |
74 |
* if the alertMessage is true it will show the contentString inside alert body.
|
|
75 |
*/
|
|
76 |
public alertMessage:boolean = true; |
|
82 |
* if the alertMessage is true it will show the contentString inside alert body. |
|
83 |
*/ |
|
84 |
public alertMessage: boolean = true;
|
|
77 | 85 |
/** |
78 |
* Some message/content can be set in message which will be shown in alert body.
|
|
79 |
*/
|
|
80 |
public message:string; |
|
86 |
* Some message/content can be set in message which will be shown in alert body. |
|
87 |
*/ |
|
88 |
public message: string;
|
|
81 | 89 |
/** |
82 |
* if the value is true alert footer will be visible or else it will be hidden.
|
|
83 |
*/
|
|
84 |
public alertFooter:boolean= true;
|
|
90 |
* if the value is true alert footer will be visible or else it will be hidden. |
|
91 |
*/ |
|
92 |
public alertFooter: boolean = true;
|
|
85 | 93 |
/** |
86 |
* shows alert header if the value is true.
|
|
87 |
*/
|
|
88 |
public alertHeader:boolean = true; |
|
94 |
* shows alert header if the value is true. |
|
95 |
*/ |
|
96 |
public alertHeader: boolean = true;
|
|
89 | 97 |
/** |
90 |
* if the value is true alert will be visible or else it will be hidden.
|
|
91 |
*/
|
|
92 |
public isOpen:boolean=false;
|
|
98 |
* if the value is true alert will be visible or else it will be hidden. |
|
99 |
*/ |
|
100 |
public isOpen: boolean = false;
|
|
93 | 101 |
|
94 | 102 |
/** |
95 | 103 |
* if the value is true ok button align on the left, else on the right |
... | ... | |
101 | 109 |
*/ |
102 | 110 |
@Input() |
103 | 111 |
public okDisabled: boolean = false; |
112 |
|
|
113 |
@Input() |
|
114 |
public choice: boolean = false; |
|
115 |
|
|
116 |
public select: boolean = false; |
|
104 | 117 |
/** |
105 |
* Emitted when a ok button was clicked |
|
106 |
* or when Ok method is called. |
|
107 |
*/ |
|
108 |
@Output() public alertOutput:EventEmitter<any> = new EventEmitter(); |
|
109 |
constructor( public _elementRef: ElementRef){} |
|
118 |
* Emitted when a ok button was clicked |
|
119 |
* or when Ok method is called. |
|
120 |
*/ |
|
121 |
@Output() public alertOutput: EventEmitter<any> = new EventEmitter(); |
|
122 |
|
|
123 |
constructor(public _elementRef: ElementRef) { |
|
124 |
} |
|
125 |
|
|
110 | 126 |
/** |
111 |
* Opens a alert window creating backdrop.
|
|
112 |
*/
|
|
113 |
open(){ |
|
114 |
this.isOpen= true; |
|
127 |
* Opens a alert window creating backdrop. |
|
128 |
*/ |
|
129 |
open() {
|
|
130 |
this.isOpen = true;
|
|
115 | 131 |
} |
132 |
|
|
116 | 133 |
/** |
117 |
* ok method closes the modal and emits modalOutput.
|
|
118 |
*/
|
|
119 |
ok(){ |
|
134 |
* ok method closes the modal and emits modalOutput. |
|
135 |
*/ |
|
136 |
ok() {
|
|
120 | 137 |
this.isOpen = false; |
121 |
this.alertOutput.emit(true); |
|
138 |
if (!this.choice) { |
|
139 |
this.alertOutput.emit(true); |
|
140 |
} else { |
|
141 |
this.alertOutput.emit({ |
|
142 |
value: true, |
|
143 |
choice: this.select |
|
144 |
}); |
|
145 |
} |
|
122 | 146 |
} |
147 |
|
|
123 | 148 |
/** |
124 |
* cancel method closes the moda.
|
|
125 |
*/
|
|
126 |
cancel(){ |
|
149 |
* cancel method closes the moda. |
|
150 |
*/ |
|
151 |
cancel() {
|
|
127 | 152 |
this.isOpen = false; |
128 | 153 |
} |
129 | 154 |
} |
Also available in: Unified diff
[Library]: Modal: Add option to have a dont show message again checkbox. Add service to save on localStorage user's choices(only communityDireckLink now). Change search Communities result with new functionality.