'pid' field added in entities and communities for queries by portal - can be changed by forms
bug fix in cancel/save in pageContents form page in pageContents form cannot be changed when editing contents of specific page order in pageContents form can be set by hand (text not number) api for pageContents of specific community changed git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@50388 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
989bb6394b
commit
aec61776ae
|
@ -80,7 +80,7 @@
|
|||
|
||||
</li>
|
||||
<li class="uk-nav-header uk-parent">
|
||||
Help Content
|
||||
Manage Help Content
|
||||
|
||||
<ul class="uk-nav-sub">
|
||||
<li>
|
||||
|
|
|
@ -3,6 +3,7 @@ import {Entity} from './entity';
|
|||
|
||||
export interface Community {
|
||||
_id: string;
|
||||
pid: string;
|
||||
name: string;
|
||||
entities: string[] | Entity[];
|
||||
pages: string[] | Page[];
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
export class Entity {
|
||||
_id: string;
|
||||
pid: string;
|
||||
name: string;
|
||||
isEnabled :boolean;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
<form [formGroup]="myForm">
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.name.valid && myForm.controls.name.dirty}">
|
||||
<label for="pageNameTag">Community Name</label>
|
||||
<label for="communityNameTag">Community Name</label>
|
||||
<input type="text" class="form-control" formControlName="name" id="pageNameTag" placeholder="Community Name">
|
||||
</div>
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.pid.valid && myForm.controls.pid.dirty}">
|
||||
<label for="communityPidTag">Community persistent id for portal</label>
|
||||
<input type="text" class="uk-input uk-width-medium" formControlName="pid" id="communityPidTag" placeholder="Community Pid">
|
||||
</div>
|
||||
<input type="hidden" formControlName="_id">
|
||||
</form>
|
||||
|
|
|
@ -21,6 +21,7 @@ export class CommunityFormComponent implements OnInit{
|
|||
public get form() {
|
||||
return this._fb.group({
|
||||
_id : '',
|
||||
pid: ['', Validators.required],
|
||||
name : ['', Validators.required]
|
||||
});
|
||||
}
|
||||
|
@ -28,7 +29,8 @@ export class CommunityFormComponent implements OnInit{
|
|||
public reset() {
|
||||
this.myForm.patchValue({
|
||||
name : '',
|
||||
_id : ''
|
||||
_id : '',
|
||||
pid: ''
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
<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>
|
||||
<page-content-form [communityId]="communityId" [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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -75,6 +75,13 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
} else {
|
||||
this.errorMessage = "Please fill all required fields";
|
||||
}
|
||||
}
|
||||
|
||||
private cancelCustom() {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityId, "page": this.pageId } } );
|
||||
} else {
|
||||
this.router.navigate(['/pageContents']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
<label for="entityNameTag">Entity Name</label>
|
||||
<input type="text" class="uk-input uk-width-medium" formControlName="name" id="entityNameTag" placeholder="Entity Name">
|
||||
</div>
|
||||
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.pid.valid && myForm.controls.pid.dirty}">
|
||||
<label for="entityPidTag">Entity persistent id for portal</label>
|
||||
<input type="text" class="uk-input uk-width-medium" formControlName="pid" id="entityPidTag" placeholder="Entity Pid">
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<div ngModelGroup="phoneNumbers">
|
||||
|
|
|
@ -19,14 +19,18 @@ export class EntityFormComponent implements OnInit{
|
|||
|
||||
public get form() {
|
||||
return this._fb.group({
|
||||
pid: ['', Validators.required],
|
||||
name : ['', Validators.required],
|
||||
isEnabled: '',
|
||||
_id : ''
|
||||
});
|
||||
}
|
||||
|
||||
public reset() {
|
||||
this.myForm.patchValue({
|
||||
pid: '',
|
||||
name : '',
|
||||
isEnabled: '',
|
||||
_id : ''
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@
|
|||
|
||||
<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>
|
||||
<page-content-form [communityId]="communityId" [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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -41,6 +41,7 @@ export class NewPageHelpContentComponent {
|
|||
|
||||
if(this.formComponent.myForm.valid) {
|
||||
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
|
||||
|
||||
this._helpContentService.savePageHelpContent(pageHelpContent).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
|
@ -56,6 +57,14 @@ export class NewPageHelpContentComponent {
|
|||
}
|
||||
}
|
||||
|
||||
private cancelCustom() {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityId, "page": this.pageId } } );
|
||||
} else {
|
||||
this.router.navigate(['/pageContents']);
|
||||
}
|
||||
}
|
||||
|
||||
handleError(message: string, error) {
|
||||
this.errorMessage = message + ' (Server responded: ' + error + ')';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div *ngIf="errorMessage" class="uk-alert-danger" uk-alert>{{errorMessage}}</div>
|
||||
<form [formGroup]="myForm">
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.page.valid && myForm.controls.page.dirty}">
|
||||
<div *ngIf="!pageId" class="form-group" [ngClass]="{'has-error':!myForm.controls.page.valid && myForm.controls.page.dirty}">
|
||||
<label for="pageTag">Select Page</label>
|
||||
<select formControlName="page" id="pageTag" class="form-control">
|
||||
<option *ngFor="let page of availablePages" [value]="page._id">{{page.name}}</option>
|
||||
|
@ -36,7 +36,7 @@
|
|||
</div>
|
||||
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.order.valid && myForm.controls.order.dirty}">
|
||||
<label for="orderTag">Order</label>
|
||||
<input type="number" step="1" class="form-control" formControlName="order" id="orderTag" placeholder="Order (e.g. 2)">
|
||||
<input type="text" step="1" class="form-control" formControlName="order" id="orderTag" placeholder="Order (e.g. 2)">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>Select Status</label>
|
||||
|
|
|
@ -18,6 +18,8 @@ export class PageContentFormComponent implements OnInit{
|
|||
myForm: FormGroup;
|
||||
@Input('communityId')
|
||||
communityId: string;
|
||||
@Input('pageId')
|
||||
pageId: string;
|
||||
|
||||
private availablePages : Page[] = [];
|
||||
private errorMessage: string;
|
||||
|
@ -35,7 +37,7 @@ export class PageContentFormComponent implements OnInit{
|
|||
|
||||
public get form() {
|
||||
return this._fb.group({
|
||||
page : ['',Validators.required],
|
||||
page : [this.pageId,Validators.required],
|
||||
community : this.communityId,
|
||||
placement : ['', Validators.required],
|
||||
content : ['', Validators.required],
|
||||
|
|
|
@ -233,7 +233,7 @@
|
|||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<a class="helpContents" [queryParams]="{community: selectedCommunityId, page: check.page._id}" routerLink="/pageContents">edit</a>
|
||||
<a class="helpContents" [queryParams]="{community: selectedCommunityId, page: check.page._id}" routerLink="/pageContents">add contents</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -218,7 +218,7 @@ export class HelpContentService {
|
|||
}
|
||||
|
||||
getCommunityPageHelpContents(community_id: string) {
|
||||
return this.http.get(this._helpContentUrl + 'pagehelpcontent/community/'+community_id)
|
||||
return this.http.get(this._helpContentUrl + 'pagehelpcontent?communityId='+community_id)
|
||||
.map(res => <Array<PageHelpContent>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue