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
This commit is contained in:
konstantina.galouni 2018-01-08 09:29:40 +00:00
parent 95a84a12ed
commit 527f3744cb
10 changed files with 68 additions and 31 deletions

View File

@ -13,6 +13,7 @@
<div>
<div *ngIf="errorMessage" class="uk-alert-danger" uk-alert>{{errorMessage}}</div>
<page-content-form [communityId]="communityId" [group]="formGroup"></page-content-form>
<a [queryParams]="{community: communityId, page: pageId}" routerLink="/pageContents" class="btn"><i></i>Cancel</a>
<a (click)="saveCustom()" class="btn btn-success"><i></i>Update page content</a>
</div>
</div>

View File

@ -25,6 +25,8 @@
<button class="uk-button uk-button-default" type="button"> Bulk Actions</button>
<div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav">
<li><a (click)="toggleEntities(true, getSelectedEntities())"><i></i> Activate </a></li>
<li><a (click)="toggleEntities(false, getSelectedEntities())"><i></i> Deactivate </a></li>
<li><a (click)="confirmDeleteSelectedEntities()"><i></i> Delete </a></li>
</ul>
</div>
@ -72,10 +74,10 @@
</td>
<td>
<div *ngIf="check.entity.isEnabled" class="activated" >
<input (click)="toggleEntity(false,[check.entity._id])" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
<input (click)="toggleEntities(false,[check.entity._id])" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
</div>
<div *ngIf="!check.entity.isEnabled" class="deactivated" >
<input (click)="toggleEntity(true,[check.entity._id])" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20">
<input (click)="toggleEntities(true,[check.entity._id])" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20">
</div>
</td>
<td>

View File

@ -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)
);

View File

@ -13,6 +13,7 @@
<div>
<div *ngIf="errorMessage" class="uk-alert-danger" uk-alert>{{errorMessage}}</div>
<page-content-form [communityId]="communityId" [group]="formGroup"></page-content-form>
<a [queryParams]="{community: communityId, page: pageId}" routerLink="/pageContents" class="btn"><i></i>Cancel</a>
<a (click)="saveCustom()" class="btn btn-success"><i></i>Save page content</a>
</div>
</div>

View File

@ -143,7 +143,8 @@
<div class="menubar ">
<div class="pageHelpContent-title uk-article-title">Page Help Contents</div>
<div *ngIf="!selectedPageId" class="pageHelpContent-title uk-article-title">Page Help Contents</div>
<div *ngIf="selectedPageId && page && community" class="pageHelpContent-title uk-article-title">'{{page.name}}' Help Contents of community {{community.name}}</div>
<form target="BSFormPanel_Admin_1" class="search">
<input #inputstring (keyup.enter)="filterBySearch(inputstring.value)" placeholder="Page Help Content..." type="text" class="uk-input uk-width-medium"/>
@ -217,8 +218,8 @@
<thead>
<tr>
<th><input id="allPageHelpContentsCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
<th>Page</th>
<th>Community</th>
<th *ngIf="!selectedPageId">Page</th>
<th *ngIf="!selectedPageId">Community</th>
<th>Content</th>
<th>Placement</th>
<th>Order</th>
@ -231,10 +232,10 @@
<td><input id="{{check.pageHelpContent._id}}" class="checkBox" type="checkbox"
name="entitiescb[]" value="{{check.pageHelpContent._id}}" [(ngModel)]="check.checked">
</td>
<td>
<td *ngIf="!selectedPageId">
<div class="page" href="#">{{check.pageHelpContent.page.name}}</div>
</td>
<td>
<td *ngIf="!selectedPageId">
<div class="community" href="#">{{check.pageHelpContent.community.name}}</div>
</td>
<td>
@ -271,7 +272,7 @@
</div>
</div>
</div>
<a *ngIf="selectedPageId" [queryParams]="{type: pageType}" routerLink="/pages">Go back to {{pageType}} pages</a>
<a *ngIf="selectedPageId && page" [queryParams]="{type: page.type}" routerLink="/pages">Go back to {{page.type}} pages</a>
</div>
</div>
</div>

View File

@ -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;
}
);
}

View File

@ -162,6 +162,8 @@
<button class="uk-button uk-button-default" type="button"> Bulk Actions</button>
<div uk-dropdown="mode: click">
<ul class="uk-nav uk-dropdown-nav">
<li><a (click)="togglePages(true, getSelectedPages())"><i></i> Activate </a></li>
<li><a (click)="togglePages(false, getSelectedPages())"><i></i> Deactivate </a></li>
<li><a (click)="confirmDeleteSelectedPages()"><i></i> Delete </a></li>
</ul>
</div>
@ -206,10 +208,10 @@
</td>
<td>
<div *ngIf="check.page.isEnabled" class="activated" >
<input (click)="togglePage(false,[check.page._id])" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
<input (click)="togglePages(false,[check.page._id])" class="deactivate" src="imgs/check-icon.png" title="Disable" width="20" type="image" height="20">
</div>
<div *ngIf="!check.page.isEnabled" class="deactivated" >
<input (click)="togglePage(true,[check.page._id])" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20">
<input (click)="togglePages(true,[check.page._id])" class="deactivate" src="imgs/x-icon.png" title="Enable" width="20" type="image" height="20">
</div>
</td>
<td *ngIf="!pagesType">

View File

@ -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)

View File

@ -80,14 +80,17 @@ export class ModalFormComponent {
} else if (this.type == 'community') {
if(this.saveText == 'Update') {
this._helpService.updateCommunity(<Community> obj).subscribe(
data => this.emmitObject.emit(data),
error => this.emmitError.emit(error)
data => this.emmitObject.emit(data),
error => this.emmitError.emit(error)
);
console.info(<Community> obj);
} else if(this.saveText == 'Save') {
this._helpService.saveCommunity(<Community> obj).subscribe(
data => this.emmitObject.emit(data),
error => this.emmitError.emit(error)
data => this.emmitObject.emit(data),
error => this.emmitError.emit(error)
);
console.info(<Community> obj);
}
} else if (this.type == 'page') {
if(this.saveText == 'Update') {

View File

@ -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 => <Community> res.json())
.catch(this.handleError);
}
getCommunitiesFull() {
return this.http.get(this._helpContentUrl + 'communityFull')
.map(res => <Array<Community>> 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 => <string[]> 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});