[Library | angular-14]: menu.component: Added commented code for creating new gateway specific pages when editing custom menu.

This commit is contained in:
Konstantina Galouni 2022-12-07 12:09:01 +02:00
parent f3f395d15a
commit 9418fab774
2 changed files with 78 additions and 1 deletions

View File

@ -206,6 +206,25 @@
<div *ngIf="pageStatus != null && !pageStatus.get(menuItemForm.get('route').value) && menuItemForm.get('route').dirty" class="uk-text-center">
<span class="uk-text-warning">The item is not used because the required page is disabled</span>
</div>
<!-- <div *ngIf="selectedMenuType == 'customMenu'" class="uk-text-center uk-margin-top">Or <a (click)="newPageWindow()">create a new one</a></div>-->
<!-- <div *ngIf="newPageWindowOpen" class="uk-card uk-card-default uk-card-body uk-margin-top">-->
<!-- <div>-->
<!-- <button (click)="newPageWindow()" class="uk-close uk-icon uk-float-right" uk-close></button>-->
<!-- <h6 class="uk-text-bold uk-margin-remove-top">Create New Page</h6>-->
<!-- </div>-->
<!-- <form *ngIf="pageForm" [formGroup]="pageForm" class="uk grid uk-child-width-1-1" uk-grid>-->
<!-- <div input [formInput]="pageForm.get('name')" type="text" label="Name"-->
<!-- placeholder="Name"></div>-->
<!-- <div input [formInput]="pageForm.get('route')" type="text"-->
<!-- placeholder="Route"></div>-->
<!-- <div class="uk-flex uk-flex-right">-->
<!-- <button [disabled]="!(pageForm.get('name').value && pageForm.get('route').value)"-->
<!-- class="uk-button uk-button-secondary outlined" (click)="createPage()">Create Page-->
<!-- </button>-->
<!-- </div>-->
<!-- </form>-->
<!-- </div>-->
</div>
<!-- <div class="uk-flex" *ngIf="isPortalAdministrator">
<div class="uk-form-label uk-margin-small-right">Featured</div>

View File

@ -22,6 +22,9 @@ import {ClearCacheService} from '../../services/clear-cache.service';
import {TransitionGroupComponent} from '../../utils/transition-group/transition-group.component';
import {HelperFunctions} from '../../utils/HelperFunctions.class';
import {NotificationHandler} from '../../utils/notification-handler';
// import {Page} from "../../utils/entities/adminTool/page";
// declare var UIkit;
@Component({
selector: 'menuSelector',
@ -38,7 +41,9 @@ export class MenuComponent implements OnInit {
private index: number;
public menuItemForm: FormGroup;
// public newPageWindowOpen: boolean = false;
public menuItemForm: FormGroup;
public pageForm: FormGroup;
public menuTypes = [
{label: 'Normal Menu', value: 'normalMenu'},
@ -421,4 +426,57 @@ export class MenuComponent implements OnInit {
})
);
}
// public newPageWindow() {
// this.newPageWindowOpen = !this.newPageWindowOpen;
// this.pageForm = this._fb.group({
// _id: this._fb.control(null),
// route: this._fb.control('/featured/', [Validators.required, StringUtils.validRoute(this.allPages, 'value'), this.validCustomRoute()]),
// name: this._fb.control('', Validators.required),
// isEnabled: this._fb.control(true),
// portalType: this._fb.control(this.properties.adminToolsPortalType, Validators.required),
// portalPid: this._fb.control(this.portal),
// top: this._fb.control(true),
// bottom: this._fb.control(false),
// left: this._fb.control(false),
// right: this._fb.control(false),
// type: this._fb.control('html', Validators.required),
// entities: this._fb.control([''])
// });
// }
//
// public validCustomRoute(): ValidatorFn {
// return (control: AbstractControl): ValidationErrors | null => {
// if (control.value) {
// if (!control.value.startsWith("/featured")) {
// return {error: 'Custom route should start with /featured'}
// }
// }
// }
// }
//
// public createPage() {
// if(!this.pageForm.value.route.startsWith('/featured')) {
// this.pageForm.value.route = '/featured/'.concat(this.pageForm.value.route);
// }
//
// this.showLoading = true;
// this.subscriptions.push(
// this._helpContentService.savePage(<Page>this.pageForm.value, this.properties.adminToolsAPIURL).subscribe(
// page => {
// this.allPages.push({value: page.route, label: page.name});
// UIkit.notification('Page <b>' + page.name + '</b> has been <b>successfully created</b>', {
// status: 'success',
// timeout: 6000,
// pos: 'bottom-right'
// });
// this.newPageWindowOpen = !this.newPageWindowOpen;
// this.menuItemForm.get('route').setValue(page.route);
// this.menuItemForm.get('route').markAsDirty();
// this.showLoading = false;
// },
// error => this.handleError('System error creating page', error)
// )
// );
// }
}