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>
|
||||||
</div>
|
</div>
|
||||||
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Community'" [formGroup]="formGroup" [type]="'community'"
|
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Community'" [formGroup]="formGroup" [type]="'community'"
|
||||||
[isModalShown]="isModalShown" (emmitObject)="communitySavedSuccessfully($event)" (emmitError)="handleError($event)"
|
[isModalShown]="isModalShown" (emmitObject)="communitySavedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||||
[selectedCommunityId]="selectedCommunityId">
|
|
||||||
<community-form [group]="formGroup"></community-form>
|
<community-form [group]="formGroup"></community-form>
|
||||||
</modal-form>
|
</modal-form>
|
||||||
|
|
||||||
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Community'" [formGroup]="formGroup" [type]="'community'"
|
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Community'" [formGroup]="formGroup" [type]="'community'"
|
||||||
[isModalShown]="isModalShown" (emmitObject)="communityUpdatedSuccessfully($event)" (emmitError)="handleError($event)"
|
[isModalShown]="isModalShown" (emmitObject)="communityUpdatedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||||
[selectedCommunityId]="selectedCommunityId">
|
|
||||||
<community-form [group]="formGroup"></community-form>
|
<community-form [group]="formGroup"></community-form>
|
||||||
</modal-form>
|
</modal-form>
|
||||||
|
|
||||||
|
|
|
@ -53,9 +53,9 @@ export class CommunitiesComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||||
|
|
||||||
getCommunity(community_id: string) {
|
getCommunity(community_pid: string) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this._helpContentService.getCommunityFull(community_id).subscribe(
|
this._helpContentService.getCommunityFull(community_pid).subscribe(
|
||||||
community => {
|
community => {
|
||||||
self.communities = [community];
|
self.communities = [community];
|
||||||
this.checkboxes.push(<CheckCommunity>{community : community, checked : false});
|
this.checkboxes.push(<CheckCommunity>{community : community, checked : false});
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div *ngIf="errorMessage" class="uk-alert-danger" uk-alert>{{errorMessage}}</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)="cancelCustom()" class="uk-button uk-button-link">Cancel</button>
|
||||||
<button (click)="saveCustom()" class="uk-button uk-button-primary">Update page content</button>
|
<button (click)="saveCustom()" class="uk-button uk-button-primary">Update page content</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
||||||
@ViewChild(PageContentFormComponent)
|
@ViewChild(PageContentFormComponent)
|
||||||
public formComponent : PageContentFormComponent;
|
public formComponent : PageContentFormComponent;
|
||||||
|
|
||||||
private communityId: string;
|
private communityPid: string;
|
||||||
|
|
||||||
private pageId: string;
|
private pageId: string;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
||||||
this.sub = this.route.queryParams.subscribe(params => {
|
this.sub = this.route.queryParams.subscribe(params => {
|
||||||
//let id = params['id'];
|
//let id = params['id'];
|
||||||
let pageContentId = params['pageContentId'];
|
let pageContentId = params['pageContentId'];
|
||||||
this.communityId = params['communityId'];
|
this.communityPid = params['community'];
|
||||||
this.pageId = params['pageId'];
|
this.pageId = params['pageId'];
|
||||||
this._helpContentService.getPageHelpContent(pageContentId as string).subscribe(
|
this._helpContentService.getPageHelpContent(pageContentId as string).subscribe(
|
||||||
pageHelpContent => this.updateForm(pageHelpContent),
|
pageHelpContent => this.updateForm(pageHelpContent),
|
||||||
|
@ -62,10 +62,11 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
||||||
private saveCustom() {
|
private saveCustom() {
|
||||||
if(this.formComponent.myForm.valid) {
|
if(this.formComponent.myForm.valid) {
|
||||||
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
|
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
|
||||||
this._helpContentService.savePageHelpContent(pageHelpContent).subscribe(
|
console.info(pageHelpContent.community);
|
||||||
|
this._helpContentService.updatePageHelpContent(pageHelpContent).subscribe(
|
||||||
_ => {
|
_ => {
|
||||||
if(this.pageId) {
|
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 {
|
} else {
|
||||||
this.router.navigate(['/pageContents']);
|
this.router.navigate(['/pageContents']);
|
||||||
}
|
}
|
||||||
|
@ -79,7 +80,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
||||||
|
|
||||||
private cancelCustom() {
|
private cancelCustom() {
|
||||||
if(this.pageId) {
|
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 {
|
} else {
|
||||||
this.router.navigate(['/pageContents']);
|
this.router.navigate(['/pageContents']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
<span>Filter by community:</span>
|
<span>Filter by community:</span>
|
||||||
<select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
|
<select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
|
||||||
<!--option value="">-- none selected --</option-->
|
<!--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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -102,14 +102,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Entity'" [formGroup]="formGroup" [type]="'entity'"
|
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Entity'" [formGroup]="formGroup" [type]="'entity'"
|
||||||
[isModalShown]="isModalShown" (emmitObject)="entitySavedSuccessfully($event)" (emmitError)="handleError($event)"
|
[isModalShown]="isModalShown" (emmitObject)="entitySavedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||||
[selectedCommunityId]="selectedCommunityId">
|
|
||||||
<entity-form [group]="formGroup"></entity-form>
|
<entity-form [group]="formGroup"></entity-form>
|
||||||
</modal-form>
|
</modal-form>
|
||||||
|
|
||||||
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Entity'" [formGroup]="formGroup" [type]="'entity'"
|
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Entity'" [formGroup]="formGroup" [type]="'entity'"
|
||||||
[isModalShown]="isModalShown" (emmitObject)="entityUpdatedSuccessfully($event)" (emmitError)="handleError($event)"
|
[isModalShown]="isModalShown" (emmitObject)="entityUpdatedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||||
[selectedCommunityId]="selectedCommunityId">
|
|
||||||
<entity-form [group]="formGroup"></entity-form>
|
<entity-form [group]="formGroup"></entity-form>
|
||||||
</modal-form>
|
</modal-form>
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ export class EntitiesComponent implements OnInit {
|
||||||
|
|
||||||
public communities: Community[] = [];
|
public communities: Community[] = [];
|
||||||
|
|
||||||
public selectedCommunityId: string;
|
public selectedCommunityPid: string;
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.getCommunities();
|
this.getCommunities();
|
||||||
|
@ -54,15 +54,15 @@ export class EntitiesComponent implements OnInit {
|
||||||
this._helpContentService.getCommunities().subscribe(
|
this._helpContentService.getCommunities().subscribe(
|
||||||
communities => {
|
communities => {
|
||||||
self.communities = communities;
|
self.communities = communities;
|
||||||
self.getEntities(self.communities[0]._id);
|
self.selectedCommunityPid = self.communities[0].pid;
|
||||||
self.selectedCommunityId = self.communities[0]._id;
|
self.getEntities(self.selectedCommunityPid);
|
||||||
},
|
},
|
||||||
error => this.handleError('System error retrieving communities', error));
|
error => this.handleError('System error retrieving communities', error));
|
||||||
}
|
}
|
||||||
|
|
||||||
getEntities(community_id: string) {
|
getEntities(community_pid: string) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this._helpContentService.getCommunityEntities(community_id).subscribe(
|
this._helpContentService.getCommunityEntities(community_pid).subscribe(
|
||||||
entities => {
|
entities => {
|
||||||
self.entities = entities;
|
self.entities = entities;
|
||||||
self.checkboxes = [];
|
self.checkboxes = [];
|
||||||
|
@ -158,16 +158,16 @@ export class EntitiesComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
public filterByCommunity(event: any) {
|
public filterByCommunity(event: any) {
|
||||||
this.selectedCommunityId = event.target.value;
|
this.selectedCommunityPid = event.target.value;
|
||||||
this.applyCommunityFilter(this.selectedCommunityId);
|
this.applyCommunityFilter(this.selectedCommunityPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public applyCommunityFilter(community_id: string) {
|
public applyCommunityFilter(community_pid: string) {
|
||||||
this.getEntities(community_id);
|
this.getEntities(community_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public toggleEntities(status : boolean, ids : string[]) {
|
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) {
|
for(let id of ids) {
|
||||||
let i = this.checkboxes.findIndex(_ => _.entity._id == id);
|
let i = this.checkboxes.findIndex(_ => _.entity._id == id);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div *ngIf="errorMessage" class="uk-alert-danger" uk-alert>{{errorMessage}}</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)="cancelCustom()" class="uk-button uk-button-link">Cancel</button>
|
||||||
<button (click)="saveCustom()" class="uk-button uk-button-primary">Save page content</button>
|
<button (click)="saveCustom()" class="uk-button uk-button-primary">Save page content</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,7 +19,7 @@ export class NewPageHelpContentComponent {
|
||||||
|
|
||||||
private errorMessage : string = null;
|
private errorMessage : string = null;
|
||||||
|
|
||||||
private communityId: string;
|
private communityPid: string;
|
||||||
|
|
||||||
private pageId: string;
|
private pageId: string;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ export class NewPageHelpContentComponent {
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe(params => {
|
||||||
this.communityId = params['communityId'];
|
this.communityPid = params['community'];
|
||||||
this.pageId = params['pageId'];
|
this.pageId = params['pageId'];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ export class NewPageHelpContentComponent {
|
||||||
this._helpContentService.savePageHelpContent(pageHelpContent).subscribe(
|
this._helpContentService.savePageHelpContent(pageHelpContent).subscribe(
|
||||||
_ => {
|
_ => {
|
||||||
if(this.pageId) {
|
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 {
|
} else {
|
||||||
this.router.navigate(['/pageContents']);
|
this.router.navigate(['/pageContents']);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ export class NewPageHelpContentComponent {
|
||||||
|
|
||||||
private cancelCustom() {
|
private cancelCustom() {
|
||||||
if(this.pageId) {
|
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 {
|
} else {
|
||||||
this.router.navigate(['/pageContents']);
|
this.router.navigate(['/pageContents']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@ export class PageFormComponent implements OnInit{
|
||||||
|
|
||||||
@Input('group')
|
@Input('group')
|
||||||
myForm: FormGroup;
|
myForm: FormGroup;
|
||||||
@Input('selectedCommunityId')
|
|
||||||
public selectedCommunityId: string;
|
|
||||||
@Input('type')
|
@Input('type')
|
||||||
public type: string;
|
public type: string;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@ export class PageContentFormComponent implements OnInit{
|
||||||
|
|
||||||
@Input('group')
|
@Input('group')
|
||||||
myForm: FormGroup;
|
myForm: FormGroup;
|
||||||
@Input('communityId')
|
@Input('communityPid')
|
||||||
communityId: string;
|
communityPid: string;
|
||||||
@Input('pageId')
|
@Input('pageId')
|
||||||
pageId: string;
|
pageId: string;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ export class PageContentFormComponent implements OnInit{
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.myForm = this.form;
|
this.myForm = this.form;
|
||||||
this._helpContentService.getCommunityPages(this.communityId).subscribe(
|
this._helpContentService.getCommunityPages(this.communityPid).subscribe(
|
||||||
pages => this.availablePages = pages,
|
pages => this.availablePages = pages,
|
||||||
error => this.handleError('System error retrieving pages', error));
|
error => this.handleError('System error retrieving pages', error));
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ export class PageContentFormComponent implements OnInit{
|
||||||
public get form() {
|
public get form() {
|
||||||
return this._fb.group({
|
return this._fb.group({
|
||||||
page : [this.pageId,Validators.required],
|
page : [this.pageId,Validators.required],
|
||||||
community : this.communityId,
|
community : this.communityPid,
|
||||||
placement : ['', Validators.required],
|
placement : ['', Validators.required],
|
||||||
content : ['', Validators.required],
|
content : ['', Validators.required],
|
||||||
order : ['1', Validators.required],
|
order : ['1', Validators.required],
|
||||||
|
@ -50,7 +50,7 @@ export class PageContentFormComponent implements OnInit{
|
||||||
public reset() {
|
public reset() {
|
||||||
this.myForm.patchValue({
|
this.myForm.patchValue({
|
||||||
page : '',
|
page : '',
|
||||||
community : this.communityId,
|
community : this.communityPid,
|
||||||
placement : '',
|
placement : '',
|
||||||
content : [''],
|
content : [''],
|
||||||
order : '1',
|
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"/>
|
<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>
|
<button class="uk-button uk-button-default" type="submit">Search</button>
|
||||||
</form>
|
</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]="{community: selectedCommunityPid}" 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, pageId: selectedPageId}" routerLink="/pageContents/new" class="uk-button uk-button-primary uk-float-right"><i></i> New Page Content </a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content-wrapper" id="contentWrapper">
|
<div class="content-wrapper" id="contentWrapper">
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
<div class="links form-group form-inline">
|
<div class="links form-group form-inline">
|
||||||
<span>Filter by community:</span>
|
<span>Filter by community:</span>
|
||||||
<select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
|
<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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -49,7 +49,7 @@ export class PageHelpContentsComponent implements OnInit {
|
||||||
|
|
||||||
public communities: Community[] = [];
|
public communities: Community[] = [];
|
||||||
|
|
||||||
public selectedCommunityId: string;
|
public selectedCommunityPid: string;
|
||||||
|
|
||||||
public selectedPageId: string;
|
public selectedPageId: string;
|
||||||
|
|
||||||
|
@ -60,13 +60,13 @@ export class PageHelpContentsComponent implements OnInit {
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.route.queryParams.subscribe(params => {
|
this.route.queryParams.subscribe(params => {
|
||||||
|
|
||||||
this.selectedCommunityId = params['community'];
|
this.selectedCommunityPid = params['community'];
|
||||||
this.selectedPageId = params['page'];
|
this.selectedPageId = params['page'];
|
||||||
|
|
||||||
if(this.selectedCommunityId && this.selectedPageId) {
|
if(this.selectedCommunityPid && this.selectedPageId) {
|
||||||
this.getPageHelpContents(this.selectedCommunityId);
|
this.getPageHelpContents(this.selectedCommunityPid);
|
||||||
this.getPage(this.selectedPageId);
|
this.getPage(this.selectedPageId);
|
||||||
this.getCommunity(this.selectedCommunityId);
|
this.getCommunity(this.selectedCommunityPid);
|
||||||
} else {
|
} else {
|
||||||
this.selectedPageId = "";
|
this.selectedPageId = "";
|
||||||
this.getCommunities();
|
this.getCommunities();
|
||||||
|
@ -86,9 +86,9 @@ export class PageHelpContentsComponent implements OnInit {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommunity(communityId: string) {
|
getCommunity(communityPid: string) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this._helpService.getCommunity(communityId).subscribe(
|
this._helpService.getCommunity(communityPid).subscribe(
|
||||||
community => {
|
community => {
|
||||||
self.community = community;
|
self.community = community;
|
||||||
}
|
}
|
||||||
|
@ -100,15 +100,15 @@ export class PageHelpContentsComponent implements OnInit {
|
||||||
this._helpService.getCommunities().subscribe(
|
this._helpService.getCommunities().subscribe(
|
||||||
communities => {
|
communities => {
|
||||||
self.communities = communities;
|
self.communities = communities;
|
||||||
self.selectedCommunityId = self.communities[0]._id;
|
self.selectedCommunityPid = self.communities[0].pid;
|
||||||
this.getPages(self.selectedCommunityId);
|
this.getPages(self.selectedCommunityPid);
|
||||||
this.getPageHelpContents(self.selectedCommunityId);
|
this.getPageHelpContents(self.selectedCommunityPid);
|
||||||
},
|
},
|
||||||
error => this.handleError('System error retrieving communities', error));
|
error => this.handleError('System error retrieving communities', error));
|
||||||
}
|
}
|
||||||
|
|
||||||
getPages(community_id: string) {
|
getPages(community_pid: string) {
|
||||||
this._helpService.getCommunityPages(community_id).subscribe(
|
this._helpService.getCommunityPages(community_pid).subscribe(
|
||||||
pages => this.pages = pages,
|
pages => this.pages = pages,
|
||||||
error => this.handleError('System error retrieving pages', error));
|
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;
|
this.counter.all = this.counter.active + this.counter.inactive;
|
||||||
}
|
}
|
||||||
|
|
||||||
getPageHelpContents(community_id: string) {
|
getPageHelpContents(community_pid: string) {
|
||||||
let self = this;
|
let self = this;
|
||||||
this._helpService.getCommunityPageHelpContents(community_id).subscribe(
|
this._helpService.getCommunityPageHelpContents(community_pid).subscribe(
|
||||||
pageHelpContents => {
|
pageHelpContents => {
|
||||||
self.pageHelpContents = pageHelpContents as Array<PageHelpContent>;
|
self.pageHelpContents = pageHelpContents as Array<PageHelpContent>;
|
||||||
self.counter.all = self.pageHelpContents.length;
|
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]);
|
//this.router.navigate(['/pageContents/edit/', _id]);
|
||||||
if(this.selectedPageId) {
|
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 {
|
} 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) {
|
public filterByCommunity(event: any) {
|
||||||
this.selectedCommunityId = event.target.value;
|
this.selectedCommunityPid = event.target.value;
|
||||||
this.applyCommunityFilter(this.selectedCommunityId);
|
this.applyCommunityFilter(this.selectedCommunityPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public applyCommunityFilter(community_id: string) {
|
public applyCommunityFilter(community_pid: string) {
|
||||||
this.getPages(community_id);
|
this.getPages(community_pid);
|
||||||
this.getPageHelpContents(community_id);
|
this.getPageHelpContents(community_pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,7 +181,7 @@
|
||||||
<span>Filter by community:</span>
|
<span>Filter by community:</span>
|
||||||
<select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
|
<select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
|
||||||
<!--option value="">-- none selected --</option-->
|
<!--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>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -233,7 +233,7 @@
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@ -251,14 +251,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Page'" [formGroup]="formGroup" [type]="'page'"
|
<modal-form #saveModal [saveText]="'Save'" [titleText]="'Add a new Page'" [formGroup]="formGroup" [type]="'page'"
|
||||||
[isModalShown]="isModalShown" (emmitObject)="pageSavedSuccessfully($event)" (emmitError)="handleError($event)"
|
[isModalShown]="isModalShown" (emmitObject)="pageSavedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||||
[selectedCommunityId]="selectedCommunityId">
|
|
||||||
<page-form [group]="formGroup"></page-form>
|
<page-form [group]="formGroup"></page-form>
|
||||||
</modal-form>
|
</modal-form>
|
||||||
|
|
||||||
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Page'" [formGroup]="formGroup" [type]="'page'"
|
<modal-form #updateModal [saveText]="'Update'" [titleText]="'Update Page'" [formGroup]="formGroup" [type]="'page'"
|
||||||
[isModalShown]="isModalShown" (emmitObject)="pageUpdatedSuccessfully($event)" (emmitError)="handleError($event)"
|
[isModalShown]="isModalShown" (emmitObject)="pageUpdatedSuccessfully($event)" (emmitError)="handleError($event)">
|
||||||
[selectedCommunityId]="selectedCommunityId">
|
|
||||||
<page-form [group]="formGroup"></page-form>
|
<page-form [group]="formGroup"></page-form>
|
||||||
</modal-form>
|
</modal-form>
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ export class PagesComponent implements OnInit {
|
||||||
|
|
||||||
public communities: Community[] = [];
|
public communities: Community[] = [];
|
||||||
|
|
||||||
public selectedCommunityId: string;
|
public selectedCommunityPid: string;
|
||||||
|
|
||||||
public pagesType: string;
|
public pagesType: string;
|
||||||
|
|
||||||
|
@ -63,17 +63,17 @@ export class PagesComponent implements OnInit {
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||||
|
|
||||||
getPages(community_id: string) {
|
getPages(community_pid: string) {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
if(this.pagesType) {
|
if(this.pagesType) {
|
||||||
this._helpContentService.getCommunityPagesByType(community_id, "?page_type="+this.pagesType).subscribe(
|
this._helpContentService.getCommunityPagesByType(community_pid, "?page_type="+this.pagesType).subscribe(
|
||||||
pages => {
|
pages => {
|
||||||
self.pagesReturned(pages);
|
self.pagesReturned(pages);
|
||||||
},
|
},
|
||||||
error => this.handleError('System error retrieving pages', error));
|
error => this.handleError('System error retrieving pages', error));
|
||||||
} else {
|
} else {
|
||||||
this._helpContentService.getCommunityPages(community_id).subscribe(
|
this._helpContentService.getCommunityPages(community_pid).subscribe(
|
||||||
pages => {
|
pages => {
|
||||||
self.pagesReturned(pages);
|
self.pagesReturned(pages);
|
||||||
},
|
},
|
||||||
|
@ -95,8 +95,8 @@ export class PagesComponent implements OnInit {
|
||||||
this._helpContentService.getCommunities().subscribe(
|
this._helpContentService.getCommunities().subscribe(
|
||||||
communities => {
|
communities => {
|
||||||
self.communities = communities;
|
self.communities = communities;
|
||||||
self.getPages(self.communities[0]._id);
|
self.selectedCommunityPid = self.communities[0].pid;
|
||||||
self.selectedCommunityId = self.communities[0]._id;
|
self.getPages(self.selectedCommunityPid);
|
||||||
},
|
},
|
||||||
error => this.handleError('System error retrieving communities', error));
|
error => this.handleError('System error retrieving communities', error));
|
||||||
}
|
}
|
||||||
|
@ -193,16 +193,16 @@ export class PagesComponent implements OnInit {
|
||||||
|
|
||||||
|
|
||||||
public filterByCommunity(event: any) {
|
public filterByCommunity(event: any) {
|
||||||
this.selectedCommunityId = event.target.value;
|
this.selectedCommunityPid = event.target.value;
|
||||||
this.applyCommunityFilter(this.selectedCommunityId);
|
this.applyCommunityFilter(this.selectedCommunityPid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public applyCommunityFilter(community_id: string) {
|
public applyCommunityFilter(community_pid: string) {
|
||||||
this.getPages(community_id);
|
this.getPages(community_pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public togglePages(status : boolean, ids : string[]) {
|
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) {
|
for(let id of ids) {
|
||||||
// let i = this.checkboxes.findIndex(_ => _.page._id == id);
|
// let i = this.checkboxes.findIndex(_ => _.page._id == id);
|
||||||
|
|
|
@ -39,9 +39,6 @@ export class ModalFormComponent {
|
||||||
@Input()
|
@Input()
|
||||||
public type : string = 'topic';
|
public type : string = 'topic';
|
||||||
|
|
||||||
@Input()
|
|
||||||
public selectedCommunityId: string;
|
|
||||||
|
|
||||||
public errorMessage : string = null;
|
public errorMessage : string = null;
|
||||||
|
|
||||||
@Output() emmitObject: EventEmitter<any> = new EventEmitter();
|
@Output() emmitObject: EventEmitter<any> = new EventEmitter();
|
||||||
|
|
|
@ -44,8 +44,8 @@ export class HelpContentService {
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommunity(community_id: string) {
|
getCommunity(community_pid: string) {
|
||||||
return this.http.get(this._helpContentUrl + 'community/'+community_id)
|
return this.http.get(this._helpContentUrl + 'community/'+community_pid)
|
||||||
.map(res => <Community> res.json())
|
.map(res => <Community> res.json())
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@ export class HelpContentService {
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommunityFull(community_id: string) {
|
getCommunityFull(community_pid: string) {
|
||||||
return this.http.get(this._helpContentUrl + 'communityFull/'+community_id)
|
return this.http.get(this._helpContentUrl + 'communityFull/'+community_pid)
|
||||||
.map(res => <Community> res.json())
|
.map(res => <Community> res.json())
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
@ -92,14 +92,14 @@ export class HelpContentService {
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommunityPages(community_id: string) {
|
getCommunityPages(community_pid: string) {
|
||||||
return this.http.get(this._helpContentUrl + 'community/'+community_id+'/pages')
|
return this.http.get(this._helpContentUrl + 'community/'+community_pid+'/pages')
|
||||||
.map(res => <Array<Page>> res.json())
|
.map(res => <Array<Page>> res.json())
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommunityPagesByType(community_id: string, params: string) {
|
getCommunityPagesByType(community_pid: string, params: string) {
|
||||||
return this.http.get(this._helpContentUrl + 'community/'+community_id+'/pages'+params)
|
return this.http.get(this._helpContentUrl + 'community/'+community_pid+'/pages'+params)
|
||||||
.map(res => <Array<Page>> res.json())
|
.map(res => <Array<Page>> res.json())
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
@ -110,8 +110,8 @@ export class HelpContentService {
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommunityEntities(community_id: string) {
|
getCommunityEntities(community_pid: string) {
|
||||||
return this.http.get(this._helpContentUrl + 'community/'+community_id+'/entities')
|
return this.http.get(this._helpContentUrl + 'community/'+community_pid+'/entities')
|
||||||
.map(res => <Array<Entity>> res.json())
|
.map(res => <Array<Entity>> res.json())
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
@ -147,11 +147,11 @@ export class HelpContentService {
|
||||||
// .catch(this.handleError);
|
// .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 headers = new Headers({'Content-Type': 'application/json'});
|
||||||
let options = new RequestOptions({headers: headers});
|
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())
|
//.map( res => <string[]> res.json())
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
@ -195,11 +195,11 @@ export class HelpContentService {
|
||||||
.catch(this.handleError);
|
.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 headers = new Headers({'Content-Type': 'application/json'});
|
||||||
let options = new RequestOptions({headers: headers});
|
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);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +217,8 @@ export class HelpContentService {
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
||||||
getCommunityPageHelpContents(community_id: string) {
|
getCommunityPageHelpContents(community_pid: string) {
|
||||||
return this.http.get(this._helpContentUrl + 'pagehelpcontent?communityId='+community_id)
|
return this.http.get(this._helpContentUrl + 'pagehelpcontent?community='+community_pid)
|
||||||
.map(res => <Array<PageHelpContent>> res.json())
|
.map(res => <Array<PageHelpContent>> res.json())
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ export class HelpContentService {
|
||||||
|
|
||||||
HelpContentService.removeNulls(pageHelpContent);
|
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())
|
.map(res => <PageHelpContent> res.json())
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
@ -247,7 +247,7 @@ export class HelpContentService {
|
||||||
|
|
||||||
HelpContentService.removeNulls(pageHelpContent);
|
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())
|
.map(res => <PageHelpContent> res.json())
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue