From 527f3744cb32dffdfeac23299ac30be1ce1378b1 Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 8 Jan 2018 09:29:40 +0000 Subject: [PATCH] Cancel button in edit and new page help content | Bulk Activate/Deactivate in Entities and Pages | Page and Community info in Page help content's title when they are specified - 2 relative columns hidden git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@50248 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../edit-page-help-content.component.html | 1 + app/pages/helpcontent/entities.component.html | 6 +++-- app/pages/helpcontent/entities.component.ts | 8 +++--- .../new-page-help-content.component.html | 1 + .../page-help-contents.component.html | 13 +++++----- .../page-help-contents.component.ts | 16 ++++++++++-- app/pages/helpcontent/pages.component.html | 6 +++-- app/pages/helpcontent/pages.component.ts | 12 ++++----- app/pages/modal-form.component.ts | 11 +++++--- app/services/help-content.service.ts | 25 ++++++++++++++----- 10 files changed, 68 insertions(+), 31 deletions(-) diff --git a/app/pages/helpcontent/edit-page-help-content.component.html b/app/pages/helpcontent/edit-page-help-content.component.html index e5e8a0c..1103def 100644 --- a/app/pages/helpcontent/edit-page-help-content.component.html +++ b/app/pages/helpcontent/edit-page-help-content.component.html @@ -13,6 +13,7 @@
{{errorMessage}}
+ Cancel Update page content
diff --git a/app/pages/helpcontent/entities.component.html b/app/pages/helpcontent/entities.component.html index a1d8b53..4c1854f 100644 --- a/app/pages/helpcontent/entities.component.html +++ b/app/pages/helpcontent/entities.component.html @@ -25,6 +25,8 @@
@@ -72,10 +74,10 @@
- +
- +
diff --git a/app/pages/helpcontent/entities.component.ts b/app/pages/helpcontent/entities.component.ts index 5f1a189..a8b547e 100644 --- a/app/pages/helpcontent/entities.component.ts +++ b/app/pages/helpcontent/entities.component.ts @@ -166,12 +166,14 @@ export class EntitiesComponent implements OnInit { this.getEntities(community_id); } - public toggleEntity(status : boolean, id : string) { - this._helpContentService.toggleEntity(this.selectedCommunityId,id,status).subscribe( + public toggleEntities(status : boolean, ids : string[]) { + this._helpContentService.toggleEntities(this.selectedCommunityId,ids,status).subscribe( () => { + for(let id of ids) { let i = this.checkboxes.findIndex(_ => _.entity._id == id); this.checkboxes[i].entity.isEnabled=status; - this.applyCheck(false); + } + this.applyCheck(false); }, error => this.handleError('System error changing the status of the selected entity(-ies)', error) ); diff --git a/app/pages/helpcontent/new-page-help-content.component.html b/app/pages/helpcontent/new-page-help-content.component.html index c32b667..e4250b9 100644 --- a/app/pages/helpcontent/new-page-help-content.component.html +++ b/app/pages/helpcontent/new-page-help-content.component.html @@ -13,6 +13,7 @@
{{errorMessage}}
+ Cancel Save page content
diff --git a/app/pages/helpcontent/page-help-contents.component.html b/app/pages/helpcontent/page-help-contents.component.html index ad87465..fbabe45 100644 --- a/app/pages/helpcontent/page-help-contents.component.html +++ b/app/pages/helpcontent/page-help-contents.component.html @@ -143,7 +143,8 @@ - Go back to {{pageType}} pages + Go back to {{page.type}} pages diff --git a/app/pages/helpcontent/page-help-contents.component.ts b/app/pages/helpcontent/page-help-contents.component.ts index bfad1b6..3d3b8a0 100644 --- a/app/pages/helpcontent/page-help-contents.component.ts +++ b/app/pages/helpcontent/page-help-contents.component.ts @@ -53,7 +53,9 @@ export class PageHelpContentsComponent implements OnInit { public selectedPageId: string; - public pageType: string; + public community: Community; + + public page: Page; ngOnInit() { this.route.queryParams.subscribe(params => { @@ -64,6 +66,7 @@ export class PageHelpContentsComponent implements OnInit { if(this.selectedCommunityId && this.selectedPageId) { this.getPageHelpContents(this.selectedCommunityId); this.getPage(this.selectedPageId); + this.getCommunity(this.selectedCommunityId); } else { this.selectedPageId = ""; this.getCommunities(); @@ -78,7 +81,16 @@ export class PageHelpContentsComponent implements OnInit { let self = this; this._helpService.getPage(pageId).subscribe( page => { - self.pageType = page.type; + self.page = page; + } + ); + } + + getCommunity(communityId: string) { + let self = this; + this._helpService.getCommunity(communityId).subscribe( + community => { + self.community = community; } ); } diff --git a/app/pages/helpcontent/pages.component.html b/app/pages/helpcontent/pages.component.html index f0e67a5..3c1374b 100644 --- a/app/pages/helpcontent/pages.component.html +++ b/app/pages/helpcontent/pages.component.html @@ -162,6 +162,8 @@
@@ -206,10 +208,10 @@
- +
- +
diff --git a/app/pages/helpcontent/pages.component.ts b/app/pages/helpcontent/pages.component.ts index be06b3d..ff88f46 100644 --- a/app/pages/helpcontent/pages.component.ts +++ b/app/pages/helpcontent/pages.component.ts @@ -201,16 +201,16 @@ export class PagesComponent implements OnInit { this.getPages(community_id); } - public togglePage(status : boolean, id : string) { - this._helpContentService.togglePage(this.selectedCommunityId,id,status).subscribe( + public togglePages(status : boolean, ids : string[]) { + this._helpContentService.togglePages(this.selectedCommunityId,ids,status).subscribe( () => { - // for(let id of ret) { + for(let id of ids) { // let i = this.checkboxes.findIndex(_ => _.page._id == id); // this.checkboxes[i].page.isEnabled=status; // } - //this.countPageHelpContents(); - let i = this.checkboxes.findIndex(_ => _.page._id == id); - this.checkboxes[i].page.isEnabled=status; + let i = this.checkboxes.findIndex(_ => _.page._id == id); + this.checkboxes[i].page.isEnabled=status; + } this.applyCheck(false); }, error => this.handleError('System error changing the status of the selected page(s)', error) diff --git a/app/pages/modal-form.component.ts b/app/pages/modal-form.component.ts index 51025d0..3f63397 100644 --- a/app/pages/modal-form.component.ts +++ b/app/pages/modal-form.component.ts @@ -80,14 +80,17 @@ export class ModalFormComponent { } else if (this.type == 'community') { if(this.saveText == 'Update') { this._helpService.updateCommunity( obj).subscribe( - data => this.emmitObject.emit(data), - error => this.emmitError.emit(error) + data => this.emmitObject.emit(data), + error => this.emmitError.emit(error) ); + console.info( obj); + } else if(this.saveText == 'Save') { this._helpService.saveCommunity( obj).subscribe( - data => this.emmitObject.emit(data), - error => this.emmitError.emit(error) + data => this.emmitObject.emit(data), + error => this.emmitError.emit(error) ); + console.info( obj); } } else if (this.type == 'page') { if(this.saveText == 'Update') { diff --git a/app/services/help-content.service.ts b/app/services/help-content.service.ts index 5ab0f3e..4e8679e 100644 --- a/app/services/help-content.service.ts +++ b/app/services/help-content.service.ts @@ -44,6 +44,12 @@ export class HelpContentService { .catch(this.handleError); } + getCommunity(community_id: string) { + return this.http.get(this._helpContentUrl + 'community/'+community_id) + .map(res => res.json()) + .catch(this.handleError); + } + getCommunitiesFull() { return this.http.get(this._helpContentUrl + 'communityFull') .map(res => > res.json()) @@ -133,15 +139,23 @@ export class HelpContentService { .catch(this.handleError); } - toggleEntity(selectedCommunityId: string, id : string,status : boolean) { + // toggleEntity(selectedCommunityId: string, id : string,status : boolean) { + // let headers = new Headers({'Content-Type': 'application/json'}); + // let options = new RequestOptions({headers: headers}); + // + // return this.http.post(this._helpContentUrl + 'community/'+selectedCommunityId+'/entity/toggle?status='+ status.toString()+'&entityId='+id.toString(), options) + // .catch(this.handleError); + // } + + toggleEntities(selectedCommunityId: string, ids : string[],status : boolean) { let headers = new Headers({'Content-Type': 'application/json'}); let options = new RequestOptions({headers: headers}); - return this.http.post(this._helpContentUrl + 'community/'+selectedCommunityId+'/entity/toggle?status='+ status.toString()+'&entityId='+id.toString(), options) + return this.http.post(this._helpContentUrl +'community/'+selectedCommunityId+ '/entity/toggle?status='+ status.toString(), JSON.stringify(ids), options) + //.map( res => res.json()) .catch(this.handleError); } - deleteEntities(ids : string[]) { let headers = new Headers({'Content-Type': 'application/json'}); let options = new RequestOptions({headers: headers}); @@ -181,15 +195,14 @@ export class HelpContentService { .catch(this.handleError); } - togglePage(selectedCommunityId: string, id : string,status : boolean) { + togglePages(selectedCommunityId: string, ids : string[],status : boolean) { let headers = new Headers({'Content-Type': 'application/json'}); let options = new RequestOptions({headers: headers}); - return this.http.post(this._helpContentUrl + 'community/'+selectedCommunityId+'/page/toggle?status='+ status.toString()+'&pageId='+id.toString(), options) + return this.http.post(this._helpContentUrl + 'community/'+selectedCommunityId+'/page/toggle?status='+ status.toString(),JSON.stringify(ids), options) .catch(this.handleError); } - deletePages(ids : string[]) { let headers = new Headers({'Content-Type': 'application/json'}); let options = new RequestOptions({headers: headers});