[Trunk|Admin]: Add Message on Curators and Organizations if page is disabled.
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@56437 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
3ae34beee5
commit
6d967d4fcf
|
@ -30,6 +30,12 @@
|
|||
routerLinkActive="router-link-active">
|
||||
here
|
||||
</a>
|
||||
.
|
||||
<div *ngIf="!organizationsEnabled" class="uk-alert uk-alert-warning" role="alert">
|
||||
<span class="uk-margin-small-right uk-icon" uk-icon="warning">
|
||||
</span>
|
||||
Community's Organizations page is disabled. Please enable it <a routerLink="/pages" routerLinkActive="router-link-active" [queryParams]="{communityId: communityId, type: 'other'}">here</a>.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ export class AffiliationsComponent implements OnInit {
|
|||
@Output() resetCuratorMessages: EventEmitter<boolean> = new EventEmitter();
|
||||
public communityId: string;
|
||||
public organizationsPageId: string;
|
||||
public organizationsEnabled = false;
|
||||
|
||||
constructor(private element: ElementRef,
|
||||
private route: ActivatedRoute,
|
||||
|
@ -66,6 +67,7 @@ export class AffiliationsComponent implements OnInit {
|
|||
if(!this.curatorAffiliations) {
|
||||
this.getAffiliations();
|
||||
}
|
||||
this.organizationsPageStatus();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -226,6 +228,17 @@ export class AffiliationsComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
private organizationsPageStatus() {
|
||||
this._helpContentService.getCommunityFull(this.communityId, this.properties.adminToolsAPIURL).subscribe((community) => {
|
||||
for(let page of community.pages) {
|
||||
if(page['route'] === '/organizations') {
|
||||
this.organizationsEnabled = page['isEnabled'];
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.organizationsEnabled = false;
|
||||
})
|
||||
}
|
||||
|
||||
private change() {
|
||||
this.hasChanged = true;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
Upload a photo
|
||||
</button>
|
||||
</div>
|
||||
<div class="uk-margin-small-left">
|
||||
<div *ngIf="photo !== 'assets/common-assets/curator-default.png'" class="uk-margin-small-left">
|
||||
<button class="uk-button uk-button-danger" type="button" (click)="resetMessages(); removePhotoModal.open()">
|
||||
Remove
|
||||
</button>
|
||||
|
@ -72,6 +72,11 @@
|
|||
<tr>
|
||||
<td class="uk-text-right"></td>
|
||||
<td>
|
||||
<div *ngIf="!newCurator && !curatorsEnabled" class="uk-alert uk-alert-warning" role="alert">
|
||||
<span class="uk-margin-small-right uk-icon" uk-icon="warning">
|
||||
</span>
|
||||
Community's Curators page is disabled. Please enable it <a routerLink="/pages" routerLinkActive="router-link-active" [queryParams]="{communityId: communityId, type: 'other'}">here</a>.
|
||||
</div>
|
||||
<div *ngIf="updateErrorMessage" class="uk-alert uk-alert-danger" role="alert">{{updateErrorMessage}}</div>
|
||||
<div *ngIf="successfulSaveMessage" class="uk-alert uk-alert-success" role="alert">{{successfulSaveMessage}}</div>
|
||||
</tr>
|
||||
|
|
|
@ -9,6 +9,7 @@ import {CuratorService} from '../../openaireLibrary/connect/curators/curator.ser
|
|||
import {Curator} from '../../openaireLibrary/utils/entities/CuratorInfo';
|
||||
import {HelperFunctions} from '../../openaireLibrary/utils/HelperFunctions.class';
|
||||
import {UtilitiesService} from '../../openaireLibrary/services/utilities.service';
|
||||
import {HelpContentService} from '../../services/help-content.service';
|
||||
|
||||
@Component({
|
||||
selector: 'curator',
|
||||
|
@ -21,6 +22,11 @@ export class CuratorComponent implements OnInit {
|
|||
public updateErrorMessage = '';
|
||||
public successfulSaveMessage = '';
|
||||
|
||||
public curatorsEnabled;
|
||||
public newCurator;
|
||||
|
||||
public communityId = null;
|
||||
|
||||
public affiliationsChanged = false;
|
||||
public hasChanged = false;
|
||||
public curatorId = null;
|
||||
|
@ -31,13 +37,14 @@ export class CuratorComponent implements OnInit {
|
|||
private file: File = null;
|
||||
private maxsize: number = 200*1024;
|
||||
private enabled = true;
|
||||
private deletePhoto =false;
|
||||
private deletePhoto = false;
|
||||
|
||||
constructor(private element: ElementRef,
|
||||
private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
private curatorService: CuratorService,
|
||||
private utilitiesService: UtilitiesService) {
|
||||
private utilitiesService: UtilitiesService,
|
||||
private helpContentService: HelpContentService) {
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,40 +56,46 @@ export class CuratorComponent implements OnInit {
|
|||
queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}
|
||||
});
|
||||
} else {
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = '';
|
||||
this.curatorId = Session.getUser().id;
|
||||
this.curatorService.getCurator(this.properties,
|
||||
this.properties.adminToolsAPIURL + 'curator/' + this.curatorId).subscribe(
|
||||
curator => {
|
||||
if (curator && Object.keys(curator).length > 0) {
|
||||
this.curator = curator;
|
||||
this.curator.email = Session.getUserEmail();
|
||||
if (this.curator.photo && this.curator.photo !== '') {
|
||||
this.photo = this.properties.utilsService + '/download/' + this.curator.photo;
|
||||
this.route.queryParams.subscribe((params) => {
|
||||
this.communityId = params['communityId'];
|
||||
this.showLoading = true;
|
||||
this.updateErrorMessage = '';
|
||||
this.curatorId = Session.getUser().id;
|
||||
this.curatorService.getCurator(this.properties,
|
||||
this.properties.adminToolsAPIURL + 'curator/' + this.curatorId).subscribe(
|
||||
curator => {
|
||||
if (curator && Object.keys(curator).length > 0) {
|
||||
this.curator = curator;
|
||||
this.curator.email = Session.getUserEmail();
|
||||
if (this.curator.photo && this.curator.photo !== '') {
|
||||
this.photo = this.properties.utilsService + '/download/' + this.curator.photo;
|
||||
} else {
|
||||
this.photo = 'assets/common-assets/curator-default.png';
|
||||
}
|
||||
this.curatorsPageStatus();
|
||||
this.showLoading = false;
|
||||
HelperFunctions.scroll();
|
||||
} else {
|
||||
this.newCurator = true;
|
||||
this.curator = new Curator();
|
||||
this.curator._id = this.curatorId;
|
||||
this.curator.email = Session.getUserEmail();
|
||||
this.curator.name = Session.getUserFullName();
|
||||
this.curator.affiliations = [];
|
||||
this.curator.bio = '';
|
||||
this.curator.photo = null;
|
||||
this.photo = 'assets/common-assets/curator-default.png';
|
||||
this.showLoading = false;
|
||||
HelperFunctions.scroll();
|
||||
}
|
||||
this.showLoading = false;
|
||||
HelperFunctions.scroll();
|
||||
} else {
|
||||
this.curator = new Curator();
|
||||
this.curator._id = this.curatorId;
|
||||
this.curator.email = Session.getUserEmail();
|
||||
this.curator.name = Session.getUserFullName();
|
||||
this.curator.affiliations = [];
|
||||
this.curator.bio = '';
|
||||
this.curator.photo = null;
|
||||
this.photo = 'assets/common-assets/curator-default.png';
|
||||
this.showLoading = false;
|
||||
HelperFunctions.scroll();
|
||||
},
|
||||
error => {
|
||||
}
|
||||
},
|
||||
error => {
|
||||
}
|
||||
);
|
||||
);
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public resetForm() {
|
||||
|
@ -107,8 +120,10 @@ export class CuratorComponent implements OnInit {
|
|||
this.photo = 'assets/common-assets/curator-default.png';
|
||||
}
|
||||
this.showLoading = false;
|
||||
this.curatorsPageStatus();
|
||||
HelperFunctions.scroll();
|
||||
} else {
|
||||
this.newCurator = true;
|
||||
this.curator = new Curator();
|
||||
this.curator._id = this.curatorId;
|
||||
this.curator.email = Session.getUserEmail();
|
||||
|
@ -129,6 +144,20 @@ export class CuratorComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
private curatorsPageStatus() {
|
||||
this.helpContentService.getCommunityFull(this.communityId, this.properties.adminToolsAPIURL).subscribe((community) => {
|
||||
for(let page of community.pages) {
|
||||
if(page['route'] === '/curators') {
|
||||
this.curatorsEnabled = page['isEnabled'];
|
||||
console.log(this.curatorsEnabled)
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.curatorsEnabled = false;
|
||||
console.log(this.curatorsEnabled)
|
||||
})
|
||||
}
|
||||
|
||||
private change() {
|
||||
this.hasChanged = true;
|
||||
this.affiliationsChanged = true;
|
||||
|
@ -202,6 +231,7 @@ export class CuratorComponent implements OnInit {
|
|||
this.curator).subscribe((curator) => {
|
||||
if (curator) {
|
||||
this.handleSuccessfulSave('Your data has been saved successfully!');
|
||||
this.newCurator = false;
|
||||
this.resetChange();
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue