[Admin|Trunk]: 1. Remove Html Contents column from pages table. 2. Add enable/disable option at page edit form for positions. 3. Check from api available placements of a page. 4. Placements option hide when no page has benn selected.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@56578 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-07-16 13:22:46 +00:00
parent e7e539183a
commit 842f33f9fb
7 changed files with 64 additions and 26 deletions

View File

@ -10,6 +10,10 @@ export interface Page {
communities: boolean;
openaire: boolean;
entities: Entity[] | string[];
top: boolean;
bottom: boolean;
left: boolean;
right: boolean;
}
export interface CheckPage {

View File

@ -16,7 +16,7 @@
<div [style.display]="showLoading ? 'inline' : 'none'" class="uk-animation-fade uk-width-1-1" role="alert"><img class="uk-align-center loading-gif"></div>
<page-content-form [communityPid]="communityPid" [pageId]="pageId" [updateErrorMessage]="updateErrorMessage"></page-content-form>
<button (click)="saveCustom()" class="uk-button uk-button-primary">Save help text</button>
<button (click)="saveCustom()" class="uk-button uk-button-primary uk-margin-small-right">Save help text</button>
<button (click)="cancelCustom()" class="uk-button">Cancel</button>
</div>
</div>

View File

@ -16,13 +16,13 @@
<option *ngFor="let page of availablePages" [value]="page._id">{{page.name}}</option>
</select>
</div>
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.placement.valid && myForm.controls.placement.dirty}">
<div *ngIf="pageId || (myForm.controls.page.value)" class="form-group" [ngClass]="{'has-error':!myForm.controls.placement.valid && myForm.controls.placement.dirty}">
<label for="placementTag">Select Placement</label>
<select formControlName="placement" id="placementTag" class="form-control">
<option [value]="'top'">Top</option>
<option [value]="'left'">Left</option>
<option [value]="'right'">Right</option>
<option [value]="'bottom'">Bottom</option>
<option *ngIf="placements.top" [value]="'top'">Top</option>
<option *ngIf="placements.left" [value]="'left'">Left</option>
<option *ngIf="placements.right" [value]="'right'">Right</option>
<option *ngIf="placements.bottom" [value]="'bottom'">Bottom</option>
</select>
</div>
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.content.valid && myForm.controls.content.dirty}">
@ -57,12 +57,12 @@
</div>
<div class="form-group" [ngClass]="{'has-error':!myForm.controls.order.valid && myForm.controls.order.dirty}">
<label for="orderTag">Order</label>
<input type="text" step="1" class="form-control" formControlName="order" id="orderTag" placeholder="Order (e.g. 2)">
<input type="number" step="1" class="form-control" formControlName="order" id="orderTag" placeholder="Order (e.g. 2)">
</div>
<div class="form-group">
<label>Help text before existing content</label>
<label class="checkbox">
<span style="font-weight: normal;">Before</span>
<span class="uk-margin-small-right" style="font-weight: normal;">Before</span>
<input tabindex="0" type="checkbox" formControlName="isPriorTo">
</label>
@ -70,7 +70,7 @@
<div class="form-group">
<label>Select Status</label>
<label class="checkbox">
<span style="font-weight: normal;">Active</span>
<span class="uk-margin-small-right" style="font-weight: normal;">Active</span>
<input tabindex="0" type="checkbox" formControlName="isActive">
</label>

View File

@ -21,6 +21,7 @@ export class PageContentFormComponent implements OnInit{
communityPid: string;
@Input('pageId')
pageId: string;
placements = {"top": false, "bottom": false, "left": false, "right": false}
private availablePages : Page[] = [];
//private errorMessage: string;
@ -43,12 +44,21 @@ export class PageContentFormComponent implements OnInit{
if(!Session.isLoggedIn()){
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
this._helpContentService.getPages(this.properties.adminToolsAPIURL, this.communityPid).subscribe(
pages => {
this.availablePages = pages;
this.showLoading = false;
},
error => this.handleError('System error retrieving pages', error));
this.myForm.valueChanges.subscribe(value => {
let pid = value.page;
this._helpContentService.getPage(pid,this.properties.adminToolsAPIURL).subscribe(page => {
this.placements.top = page.top;
this.placements.bottom = page.bottom;
this.placements.left = page.left;
this.placements.right = page.right;
});
})
this._helpContentService.getPages(this.properties.adminToolsAPIURL, this.communityPid).subscribe(
pages => {
this.availablePages = pages;
this.showLoading = false;
},
error => this.handleError('System error retrieving pages', error));
}
});
}
@ -59,7 +69,7 @@ export class PageContentFormComponent implements OnInit{
community : this.communityPid,
placement : ['', Validators.required],
content : ['', Validators.required],
order : ['1', Validators.required],
order : [1, Validators.required],
isActive : true,
isPriorTo : false,
_id : '',
@ -72,7 +82,7 @@ export class PageContentFormComponent implements OnInit{
community : this.communityPid,
placement : '',
content : [''],
order : '1',
order : 1,
isActive : true,
isPriorTo : false,
_id : ''

View File

@ -45,6 +45,28 @@
</div>
</div>
<div class="form-group" uk-grid>
<label class="uk-width-1-1 uk-margin-small-bottom">
Enable/Disable positions of help contents for this page.
</label>
<label class="uk-width-1-4 checkbox">
<span class="uk-margin-small-right" style="font-weight: normal;">Top</span>
<input tabindex="0" type="checkbox" formControlName="top">
</label>
<label class="uk-width-1-4 checkbox">
<span class="uk-margin-small-right" style="font-weight: normal;">Bottom</span>
<input tabindex="0" type="checkbox" formControlName="bottom">
</label>
<label class="uk-width-1-4 checkbox">
<span class="uk-margin-small-right" style="font-weight: normal;">Left</span>
<input tabindex="0" type="checkbox" formControlName="left">
</label>
<label class="uk-width-1-4 checkbox">
<span class="uk-margin-small-right" style="font-weight: normal;">Right</span>
<input tabindex="0" type="checkbox" formControlName="right">
</label>
</div>
<div class="form-group uk-grid">
<label class="uk-width-2-3">Select if this page exists in OpenAIRE portal</label>
<label class="uk-width-1-3 checkbox">

View File

@ -107,6 +107,10 @@ export class PageFormComponent implements OnInit{
openaire: true,
connect: false,
communities: true,
top: true,
bottom: true,
left: true,
right: true,
type: ['', Validators.required],
entities: this._fb.array([]),
_id : '',
@ -123,6 +127,10 @@ export class PageFormComponent implements OnInit{
openaire: true,
connect: false,
communities: true,
top: true,
bottom: true,
left: true,
right: true,
_id : '',
isCollapsed: [true]
});

View File

@ -63,9 +63,8 @@
<th *ngIf="!isPortalAdministrator">Related Entities</th>
<th>Route</th>
<th *ngIf="isPortalAdministrator" >Actions</th>
<th *ngIf="!isPortalAdministrator && (!pagesType || (pagesType!='other' && pagesType!='html'))" class="uk-text-center">Page help texts</th>
<th *ngIf="!isPortalAdministrator" class="uk-text-center">Page help texts</th>
<th *ngIf="!isPortalAdministrator && (pageWithDivIds && pageWithDivIds.length > 0)" class="uk-text-center">Class help texts</th>
<th *ngIf="!isPortalAdministrator && (!pagesType || pagesType=='html')" class="uk-text-center">Html Content</th>
</tr>
</thead>
<tbody >
@ -98,18 +97,13 @@
<input title="Delete" src="assets/imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeletePage(check.page._id)">
</div>
</td>
<td *ngIf="!isPortalAdministrator && (!pagesType || (pagesType!='other' && pagesType!='html'))" class="uk-text-center">
<a *ngIf="check.page.type != 'html' && check.page.type != 'other'" class="helpContents" [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" routerLink="/pageContents">add page contents</a>
<span *ngIf="check.page.type == 'html' || check.page.type == 'other'">-</span>
<td *ngIf="!isPortalAdministrator" class="uk-text-center">
<a class="helpContents" [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" routerLink="/pageContents">add page contents</a>
</td>
<td *ngIf="!isPortalAdministrator && (pageWithDivIds && pageWithDivIds.length > 0)" class="uk-text-center">
<a *ngIf="pageWithDivIds.includes(check.page._id)" class="classHelpContents" [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" routerLink="/classContents">add class contents</a>
<span *ngIf="!pageWithDivIds.includes(check.page._id)">-</span>
</td>
<td *ngIf="!isPortalAdministrator && (!pagesType || pagesType=='html')" class="uk-text-center">
<a *ngIf="check.page.type == 'html'" class="htmlContents" [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" routerLink="/htmlPageContent/edit">edit html contents</a>
<span *ngIf="check.page.type != 'html'">-</span>
</td>
</tr>
</tbody>
</table>