1. In Community methods - use pid to query (GET Requests)
2. Toggle Pages and Toggle Entities methods use community.pid instead of community._id 3. In urls use community={community.pid} instead of community._id 4. New and Update APIs for helpcontents separated 5. In new helpcontent, pid temporarily stored as community id (API restores it) 6. Modal form doen't need selected community information as input parameter git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@50475 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
1c2f118991
commit
00b8788918
|
@ -74,14 +74,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Community'" [formGroup]="formGroup" [type]="'community'"
|
||||
[isModalShown]="isModalShown" (emmitObject)="communitySavedSuccessfully($event)" (emmitError)="handleError($event)"
|
||||
[selectedCommunityId]="selectedCommunityId">
|
||||
[isModalShown]="isModalShown" (emmitObject)="communitySavedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||
<community-form [group]="formGroup"></community-form>
|
||||
</modal-form>
|
||||
|
||||
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Community'" [formGroup]="formGroup" [type]="'community'"
|
||||
[isModalShown]="isModalShown" (emmitObject)="communityUpdatedSuccessfully($event)" (emmitError)="handleError($event)"
|
||||
[selectedCommunityId]="selectedCommunityId">
|
||||
[isModalShown]="isModalShown" (emmitObject)="communityUpdatedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||
<community-form [group]="formGroup"></community-form>
|
||||
</modal-form>
|
||||
|
||||
|
|
|
@ -53,9 +53,9 @@ export class CommunitiesComponent implements OnInit {
|
|||
|
||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||
|
||||
getCommunity(community_id: string) {
|
||||
getCommunity(community_pid: string) {
|
||||
let self = this;
|
||||
this._helpContentService.getCommunityFull(community_id).subscribe(
|
||||
this._helpContentService.getCommunityFull(community_pid).subscribe(
|
||||
community => {
|
||||
self.communities = [community];
|
||||
this.checkboxes.push(<CheckCommunity>{community : community, checked : false});
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<div>
|
||||
<div *ngIf="errorMessage" class="uk-alert-danger" uk-alert>{{errorMessage}}</div>
|
||||
<page-content-form [communityId]="communityId" [pageId]="pageId" [group]="formGroup"></page-content-form>
|
||||
<page-content-form [communityPid]="communityPid" [pageId]="pageId" [group]="formGroup"></page-content-form>
|
||||
<button (click)="cancelCustom()" class="uk-button uk-button-link">Cancel</button>
|
||||
<button (click)="saveCustom()" class="uk-button uk-button-primary">Update page content</button>
|
||||
</div>
|
||||
|
|
|
@ -18,7 +18,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
@ViewChild(PageContentFormComponent)
|
||||
public formComponent : PageContentFormComponent;
|
||||
|
||||
private communityId: string;
|
||||
private communityPid: string;
|
||||
|
||||
private pageId: string;
|
||||
|
||||
|
@ -38,7 +38,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
//let id = params['id'];
|
||||
let pageContentId = params['pageContentId'];
|
||||
this.communityId = params['communityId'];
|
||||
this.communityPid = params['community'];
|
||||
this.pageId = params['pageId'];
|
||||
this._helpContentService.getPageHelpContent(pageContentId as string).subscribe(
|
||||
pageHelpContent => this.updateForm(pageHelpContent),
|
||||
|
@ -62,10 +62,11 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
private saveCustom() {
|
||||
if(this.formComponent.myForm.valid) {
|
||||
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
|
||||
this._helpContentService.savePageHelpContent(pageHelpContent).subscribe(
|
||||
console.info(pageHelpContent.community);
|
||||
this._helpContentService.updatePageHelpContent(pageHelpContent).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityId, "page": this.pageId } } );
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityPid, "page": this.pageId } } );
|
||||
} else {
|
||||
this.router.navigate(['/pageContents']);
|
||||
}
|
||||
|
@ -79,7 +80,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
|
||||
private cancelCustom() {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityId, "page": this.pageId } } );
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityPid, "page": this.pageId } } );
|
||||
} else {
|
||||
this.router.navigate(['/pageContents']);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<span>Filter by community:</span>
|
||||
<select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
|
||||
<!--option value="">-- none selected --</option-->
|
||||
<option *ngFor="let community of communities" value="{{community._id}}">{{community.name}}</option>
|
||||
<option *ngFor="let community of communities" value="{{community.pid}}">{{community.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -102,14 +102,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Entity'" [formGroup]="formGroup" [type]="'entity'"
|
||||
[isModalShown]="isModalShown" (emmitObject)="entitySavedSuccessfully($event)" (emmitError)="handleError($event)"
|
||||
[selectedCommunityId]="selectedCommunityId">
|
||||
[isModalShown]="isModalShown" (emmitObject)="entitySavedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||
<entity-form [group]="formGroup"></entity-form>
|
||||
</modal-form>
|
||||
|
||||
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Entity'" [formGroup]="formGroup" [type]="'entity'"
|
||||
[isModalShown]="isModalShown" (emmitObject)="entityUpdatedSuccessfully($event)" (emmitError)="handleError($event)"
|
||||
[selectedCommunityId]="selectedCommunityId">
|
||||
[isModalShown]="isModalShown" (emmitObject)="entityUpdatedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||
<entity-form [group]="formGroup"></entity-form>
|
||||
</modal-form>
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ export class EntitiesComponent implements OnInit {
|
|||
|
||||
public communities: Community[] = [];
|
||||
|
||||
public selectedCommunityId: string;
|
||||
public selectedCommunityPid: string;
|
||||
|
||||
ngOnInit() {
|
||||
this.getCommunities();
|
||||
|
@ -54,15 +54,15 @@ export class EntitiesComponent implements OnInit {
|
|||
this._helpContentService.getCommunities().subscribe(
|
||||
communities => {
|
||||
self.communities = communities;
|
||||
self.getEntities(self.communities[0]._id);
|
||||
self.selectedCommunityId = self.communities[0]._id;
|
||||
self.selectedCommunityPid = self.communities[0].pid;
|
||||
self.getEntities(self.selectedCommunityPid);
|
||||
},
|
||||
error => this.handleError('System error retrieving communities', error));
|
||||
}
|
||||
|
||||
getEntities(community_id: string) {
|
||||
getEntities(community_pid: string) {
|
||||
let self = this;
|
||||
this._helpContentService.getCommunityEntities(community_id).subscribe(
|
||||
this._helpContentService.getCommunityEntities(community_pid).subscribe(
|
||||
entities => {
|
||||
self.entities = entities;
|
||||
self.checkboxes = [];
|
||||
|
@ -158,16 +158,16 @@ export class EntitiesComponent implements OnInit {
|
|||
|
||||
|
||||
public filterByCommunity(event: any) {
|
||||
this.selectedCommunityId = event.target.value;
|
||||
this.applyCommunityFilter(this.selectedCommunityId);
|
||||
this.selectedCommunityPid = event.target.value;
|
||||
this.applyCommunityFilter(this.selectedCommunityPid);
|
||||
}
|
||||
|
||||
public applyCommunityFilter(community_id: string) {
|
||||
this.getEntities(community_id);
|
||||
public applyCommunityFilter(community_pid: string) {
|
||||
this.getEntities(community_pid);
|
||||
}
|
||||
|
||||
public toggleEntities(status : boolean, ids : string[]) {
|
||||
this._helpContentService.toggleEntities(this.selectedCommunityId,ids,status).subscribe(
|
||||
this._helpContentService.toggleEntities(this.selectedCommunityPid,ids,status).subscribe(
|
||||
() => {
|
||||
for(let id of ids) {
|
||||
let i = this.checkboxes.findIndex(_ => _.entity._id == id);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<div>
|
||||
<div *ngIf="errorMessage" class="uk-alert-danger" uk-alert>{{errorMessage}}</div>
|
||||
<page-content-form [communityId]="communityId" [pageId]="pageId" [group]="formGroup"></page-content-form>
|
||||
<page-content-form [communityPid]="communityPid" [pageId]="pageId" [group]="formGroup"></page-content-form>
|
||||
<button (click)="cancelCustom()" class="uk-button uk-button-link">Cancel</button>
|
||||
<button (click)="saveCustom()" class="uk-button uk-button-primary">Save page content</button>
|
||||
</div>
|
||||
|
|
|
@ -19,7 +19,7 @@ export class NewPageHelpContentComponent {
|
|||
|
||||
private errorMessage : string = null;
|
||||
|
||||
private communityId: string;
|
||||
private communityPid: string;
|
||||
|
||||
private pageId: string;
|
||||
|
||||
|
@ -30,7 +30,7 @@ export class NewPageHelpContentComponent {
|
|||
|
||||
ngOnInit() {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.communityId = params['communityId'];
|
||||
this.communityPid = params['community'];
|
||||
this.pageId = params['pageId'];
|
||||
});
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ export class NewPageHelpContentComponent {
|
|||
this._helpContentService.savePageHelpContent(pageHelpContent).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityId, "page": this.pageId } } );
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityPid, "page": this.pageId } } );
|
||||
} else {
|
||||
this.router.navigate(['/pageContents']);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ export class NewPageHelpContentComponent {
|
|||
|
||||
private cancelCustom() {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityId, "page": this.pageId } } );
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityPid, "page": this.pageId } } );
|
||||
} else {
|
||||
this.router.navigate(['/pageContents']);
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@ export class PageFormComponent implements OnInit{
|
|||
|
||||
@Input('group')
|
||||
myForm: FormGroup;
|
||||
@Input('selectedCommunityId')
|
||||
public selectedCommunityId: string;
|
||||
@Input('type')
|
||||
public type: string;
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ export class PageContentFormComponent implements OnInit{
|
|||
|
||||
@Input('group')
|
||||
myForm: FormGroup;
|
||||
@Input('communityId')
|
||||
communityId: string;
|
||||
@Input('communityPid')
|
||||
communityPid: string;
|
||||
@Input('pageId')
|
||||
pageId: string;
|
||||
|
||||
|
@ -30,7 +30,7 @@ export class PageContentFormComponent implements OnInit{
|
|||
|
||||
ngOnInit() {
|
||||
this.myForm = this.form;
|
||||
this._helpContentService.getCommunityPages(this.communityId).subscribe(
|
||||
this._helpContentService.getCommunityPages(this.communityPid).subscribe(
|
||||
pages => this.availablePages = pages,
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ export class PageContentFormComponent implements OnInit{
|
|||
public get form() {
|
||||
return this._fb.group({
|
||||
page : [this.pageId,Validators.required],
|
||||
community : this.communityId,
|
||||
community : this.communityPid,
|
||||
placement : ['', Validators.required],
|
||||
content : ['', Validators.required],
|
||||
order : ['1', Validators.required],
|
||||
|
@ -50,7 +50,7 @@ export class PageContentFormComponent implements OnInit{
|
|||
public reset() {
|
||||
this.myForm.patchValue({
|
||||
page : '',
|
||||
community : this.communityId,
|
||||
community : this.communityPid,
|
||||
placement : '',
|
||||
content : [''],
|
||||
order : '1',
|
||||
|
|
|
@ -150,8 +150,8 @@
|
|||
<input #inputstring (keyup.enter)="filterBySearch(inputstring.value)" placeholder="Page Help Content..." type="text" class="uk-input uk-width-medium"/>
|
||||
<button class="uk-button uk-button-default" type="submit">Search</button>
|
||||
</form>
|
||||
<a *ngIf="!selectedPageId" [queryParams]="{communityId: selectedCommunityId}" routerLink="/pageContents/new" class="uk-button uk-button-primary uk-float-right"><i></i> New Page Content </a>
|
||||
<a *ngIf="selectedPageId" [queryParams]="{communityId: selectedCommunityId, pageId: selectedPageId}" routerLink="/pageContents/new" class="uk-button uk-button-primary uk-float-right"><i></i> New Page Content </a>
|
||||
<a *ngIf="!selectedPageId" [queryParams]="{community: selectedCommunityPid}" routerLink="/pageContents/new" class="uk-button uk-button-primary uk-float-right"><i></i> New Page Content </a>
|
||||
<a *ngIf="selectedPageId" [queryParams]="{community: selectedCommunityPid, pageId: selectedPageId}" routerLink="/pageContents/new" class="uk-button uk-button-primary uk-float-right"><i></i> New Page Content </a>
|
||||
</div>
|
||||
|
||||
<div class="content-wrapper" id="contentWrapper">
|
||||
|
@ -187,7 +187,7 @@
|
|||
<div class="links form-group form-inline">
|
||||
<span>Filter by community:</span>
|
||||
<select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
|
||||
<option *ngFor="let community of communities" value="{{community._id}}">{{community.name}}</option>
|
||||
<option *ngFor="let community of communities" value="{{community.pid}}">{{community.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -49,7 +49,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
|
||||
public communities: Community[] = [];
|
||||
|
||||
public selectedCommunityId: string;
|
||||
public selectedCommunityPid: string;
|
||||
|
||||
public selectedPageId: string;
|
||||
|
||||
|
@ -60,13 +60,13 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
ngOnInit() {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
|
||||
this.selectedCommunityId = params['community'];
|
||||
this.selectedCommunityPid = params['community'];
|
||||
this.selectedPageId = params['page'];
|
||||
|
||||
if(this.selectedCommunityId && this.selectedPageId) {
|
||||
this.getPageHelpContents(this.selectedCommunityId);
|
||||
if(this.selectedCommunityPid && this.selectedPageId) {
|
||||
this.getPageHelpContents(this.selectedCommunityPid);
|
||||
this.getPage(this.selectedPageId);
|
||||
this.getCommunity(this.selectedCommunityId);
|
||||
this.getCommunity(this.selectedCommunityPid);
|
||||
} else {
|
||||
this.selectedPageId = "";
|
||||
this.getCommunities();
|
||||
|
@ -86,9 +86,9 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
);
|
||||
}
|
||||
|
||||
getCommunity(communityId: string) {
|
||||
getCommunity(communityPid: string) {
|
||||
let self = this;
|
||||
this._helpService.getCommunity(communityId).subscribe(
|
||||
this._helpService.getCommunity(communityPid).subscribe(
|
||||
community => {
|
||||
self.community = community;
|
||||
}
|
||||
|
@ -100,15 +100,15 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
this._helpService.getCommunities().subscribe(
|
||||
communities => {
|
||||
self.communities = communities;
|
||||
self.selectedCommunityId = self.communities[0]._id;
|
||||
this.getPages(self.selectedCommunityId);
|
||||
this.getPageHelpContents(self.selectedCommunityId);
|
||||
self.selectedCommunityPid = self.communities[0].pid;
|
||||
this.getPages(self.selectedCommunityPid);
|
||||
this.getPageHelpContents(self.selectedCommunityPid);
|
||||
},
|
||||
error => this.handleError('System error retrieving communities', error));
|
||||
}
|
||||
|
||||
getPages(community_id: string) {
|
||||
this._helpService.getCommunityPages(community_id).subscribe(
|
||||
getPages(community_pid: string) {
|
||||
this._helpService.getCommunityPages(community_pid).subscribe(
|
||||
pages => this.pages = pages,
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
|
@ -126,9 +126,9 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
this.counter.all = this.counter.active + this.counter.inactive;
|
||||
}
|
||||
|
||||
getPageHelpContents(community_id: string) {
|
||||
getPageHelpContents(community_pid: string) {
|
||||
let self = this;
|
||||
this._helpService.getCommunityPageHelpContents(community_id).subscribe(
|
||||
this._helpService.getCommunityPageHelpContents(community_pid).subscribe(
|
||||
pageHelpContents => {
|
||||
self.pageHelpContents = pageHelpContents as Array<PageHelpContent>;
|
||||
self.counter.all = self.pageHelpContents.length;
|
||||
|
@ -198,12 +198,12 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
}
|
||||
}
|
||||
|
||||
public editPageHelpContent(_id : string) {
|
||||
public editPageHelpContent(id : string) {
|
||||
//this.router.navigate(['/pageContents/edit/', _id]);
|
||||
if(this.selectedPageId) {
|
||||
this.router.navigate( ['/pageContents/edit/'], { queryParams: { "pageContentId": _id, "communityId": this.selectedCommunityId, "pageId": this.selectedPageId } } );
|
||||
this.router.navigate( ['/pageContents/edit/'], { queryParams: { "pageContentId": id, "community": this.selectedCommunityPid, "pageId": this.selectedPageId } } );
|
||||
} else {
|
||||
this.router.navigate( ['/pageContents/edit/'], { queryParams: { "pageContentId": _id, "communityId": this.selectedCommunityId } } );
|
||||
this.router.navigate( ['/pageContents/edit/'], { queryParams: { "pageContentId": id, "community": this.selectedCommunityPid } } );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,12 +294,12 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public filterByCommunity(event: any) {
|
||||
this.selectedCommunityId = event.target.value;
|
||||
this.applyCommunityFilter(this.selectedCommunityId);
|
||||
this.selectedCommunityPid = event.target.value;
|
||||
this.applyCommunityFilter(this.selectedCommunityPid);
|
||||
}
|
||||
|
||||
public applyCommunityFilter(community_id: string) {
|
||||
this.getPages(community_id);
|
||||
this.getPageHelpContents(community_id);
|
||||
public applyCommunityFilter(community_pid: string) {
|
||||
this.getPages(community_pid);
|
||||
this.getPageHelpContents(community_pid);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@
|
|||
<span>Filter by community:</span>
|
||||
<select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
|
||||
<!--option value="">-- none selected --</option-->
|
||||
<option *ngFor="let community of communities" value="{{community._id}}">{{community.name}}</option>
|
||||
<option *ngFor="let community of communities" value="{{community.pid}}">{{community.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -233,7 +233,7 @@
|
|||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a class="helpContents" [queryParams]="{community: selectedCommunityId, page: check.page._id}" routerLink="/pageContents">add contents</a>
|
||||
<a class="helpContents" [queryParams]="{community: selectedCommunityPid, page: check.page._id}" routerLink="/pageContents">add contents</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -251,14 +251,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Page'" [formGroup]="formGroup" [type]="'page'"
|
||||
[isModalShown]="isModalShown" (emmitObject)="pageSavedSuccessfully($event)" (emmitError)="handleError($event)"
|
||||
[selectedCommunityId]="selectedCommunityId">
|
||||
[isModalShown]="isModalShown" (emmitObject)="pageSavedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||
<page-form [group]="formGroup"></page-form>
|
||||
</modal-form>
|
||||
|
||||
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Page'" [formGroup]="formGroup" [type]="'page'"
|
||||
[isModalShown]="isModalShown" (emmitObject)="pageUpdatedSuccessfully($event)" (emmitError)="handleError($event)"
|
||||
[selectedCommunityId]="selectedCommunityId">
|
||||
[isModalShown]="isModalShown" (emmitObject)="pageUpdatedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||
<page-form [group]="formGroup"></page-form>
|
||||
</modal-form>
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ export class PagesComponent implements OnInit {
|
|||
|
||||
public communities: Community[] = [];
|
||||
|
||||
public selectedCommunityId: string;
|
||||
public selectedCommunityPid: string;
|
||||
|
||||
public pagesType: string;
|
||||
|
||||
|
@ -63,17 +63,17 @@ export class PagesComponent implements OnInit {
|
|||
|
||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||
|
||||
getPages(community_id: string) {
|
||||
getPages(community_pid: string) {
|
||||
let self = this;
|
||||
|
||||
if(this.pagesType) {
|
||||
this._helpContentService.getCommunityPagesByType(community_id, "?page_type="+this.pagesType).subscribe(
|
||||
this._helpContentService.getCommunityPagesByType(community_pid, "?page_type="+this.pagesType).subscribe(
|
||||
pages => {
|
||||
self.pagesReturned(pages);
|
||||
},
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
} else {
|
||||
this._helpContentService.getCommunityPages(community_id).subscribe(
|
||||
this._helpContentService.getCommunityPages(community_pid).subscribe(
|
||||
pages => {
|
||||
self.pagesReturned(pages);
|
||||
},
|
||||
|
@ -95,8 +95,8 @@ export class PagesComponent implements OnInit {
|
|||
this._helpContentService.getCommunities().subscribe(
|
||||
communities => {
|
||||
self.communities = communities;
|
||||
self.getPages(self.communities[0]._id);
|
||||
self.selectedCommunityId = self.communities[0]._id;
|
||||
self.selectedCommunityPid = self.communities[0].pid;
|
||||
self.getPages(self.selectedCommunityPid);
|
||||
},
|
||||
error => this.handleError('System error retrieving communities', error));
|
||||
}
|
||||
|
@ -193,16 +193,16 @@ export class PagesComponent implements OnInit {
|
|||
|
||||
|
||||
public filterByCommunity(event: any) {
|
||||
this.selectedCommunityId = event.target.value;
|
||||
this.applyCommunityFilter(this.selectedCommunityId);
|
||||
this.selectedCommunityPid = event.target.value;
|
||||
this.applyCommunityFilter(this.selectedCommunityPid);
|
||||
}
|
||||
|
||||
public applyCommunityFilter(community_id: string) {
|
||||
this.getPages(community_id);
|
||||
public applyCommunityFilter(community_pid: string) {
|
||||
this.getPages(community_pid);
|
||||
}
|
||||
|
||||
public togglePages(status : boolean, ids : string[]) {
|
||||
this._helpContentService.togglePages(this.selectedCommunityId,ids,status).subscribe(
|
||||
this._helpContentService.togglePages(this.selectedCommunityPid,ids,status).subscribe(
|
||||
() => {
|
||||
for(let id of ids) {
|
||||
// let i = this.checkboxes.findIndex(_ => _.page._id == id);
|
||||
|
|
|
@ -39,9 +39,6 @@ export class ModalFormComponent {
|
|||
@Input()
|
||||
public type : string = 'topic';
|
||||
|
||||
@Input()
|
||||
public selectedCommunityId: string;
|
||||
|
||||
public errorMessage : string = null;
|
||||
|
||||
@Output() emmitObject: EventEmitter<any> = new EventEmitter();
|
||||
|
|
|
@ -44,8 +44,8 @@ export class HelpContentService {
|
|||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunity(community_id: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_id)
|
||||
getCommunity(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_pid)
|
||||
.map(res => <Community> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ export class HelpContentService {
|
|||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityFull(community_id: string) {
|
||||
return this.http.get(this._helpContentUrl + 'communityFull/'+community_id)
|
||||
getCommunityFull(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'communityFull/'+community_pid)
|
||||
.map(res => <Community> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -92,14 +92,14 @@ export class HelpContentService {
|
|||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityPages(community_id: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_id+'/pages')
|
||||
getCommunityPages(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_pid+'/pages')
|
||||
.map(res => <Array<Page>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityPagesByType(community_id: string, params: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_id+'/pages'+params)
|
||||
getCommunityPagesByType(community_pid: string, params: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_pid+'/pages'+params)
|
||||
.map(res => <Array<Page>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -110,8 +110,8 @@ export class HelpContentService {
|
|||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityEntities(community_id: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_id+'/entities')
|
||||
getCommunityEntities(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_pid+'/entities')
|
||||
.map(res => <Array<Entity>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -147,11 +147,11 @@ export class HelpContentService {
|
|||
// .catch(this.handleError);
|
||||
// }
|
||||
|
||||
toggleEntities(selectedCommunityId: string, ids : string[],status : boolean) {
|
||||
toggleEntities(selectedCommunityPid: 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(), JSON.stringify(ids), options)
|
||||
return this.http.post(this._helpContentUrl +'community/'+selectedCommunityPid+ '/entity/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
//.map( res => <string[]> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -195,11 +195,11 @@ export class HelpContentService {
|
|||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
togglePages(selectedCommunityId: string, ids : string[],status : boolean) {
|
||||
togglePages(selectedCommunityPid: 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(),JSON.stringify(ids), options)
|
||||
return this.http.post(this._helpContentUrl + 'community/'+selectedCommunityPid+'/page/toggle?status='+ status.toString(),JSON.stringify(ids), options)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
@ -217,8 +217,8 @@ export class HelpContentService {
|
|||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityPageHelpContents(community_id: string) {
|
||||
return this.http.get(this._helpContentUrl + 'pagehelpcontent?communityId='+community_id)
|
||||
getCommunityPageHelpContents(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'pagehelpcontent?community='+community_pid)
|
||||
.map(res => <Array<PageHelpContent>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -236,7 +236,7 @@ export class HelpContentService {
|
|||
|
||||
HelpContentService.removeNulls(pageHelpContent);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'pagehelpcontent', JSON.stringify(pageHelpContent), options)
|
||||
return this.http.post(this._helpContentUrl + 'pagehelpcontent/save', JSON.stringify(pageHelpContent), options)
|
||||
.map(res => <PageHelpContent> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ export class HelpContentService {
|
|||
|
||||
HelpContentService.removeNulls(pageHelpContent);
|
||||
|
||||
return this.http.put(this._helpContentUrl + 'pagehelpcontent', JSON.stringify(pageHelpContent), options)
|
||||
return this.http.post(this._helpContentUrl + 'pagehelpcontent/update', JSON.stringify(pageHelpContent), options)
|
||||
.map(res => <PageHelpContent> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue