Progress on getting the menu menu items - dev only
This commit is contained in:
parent
660c5955f7
commit
ce37ca54f7
|
@ -4,10 +4,10 @@
|
|||
<div *ngIf="!showLoading" class="uk-grid" uk-grid>
|
||||
<div class="uk-width-1-1">
|
||||
<ul *ngIf="!isPortalAdministrator" class="uk-subnav uk-subnav-pill uk-flex uk-flex-middle">
|
||||
<li [class.uk-active]="filterForm.get('status').value === 'resources'" class="uk-visible-toggle uk-position-relative uk-padding-remove-horizontal">
|
||||
<li *ngFor="let item of rootMenuItems; let i=index" [class.uk-active]="activeRootMenu==item['_id']" class="uk-visible-toggle uk-position-relative uk-padding-remove-horizontal">
|
||||
<span>
|
||||
<a (click)="filterForm.get('status').setValue('resources')">
|
||||
<span class="title">Resourses</span>
|
||||
<a (click)="filterForm.get('status').setValue('resources'); activeRootMenu=item['_id']">
|
||||
<span class="title">{{item.title}}</span>
|
||||
</a>
|
||||
<span class="uk-invisible-hover uk-position-center-right color">
|
||||
<span class="clickable" uk-icon="more-vertical"></span>
|
||||
|
@ -84,8 +84,8 @@
|
|||
<loading></loading>
|
||||
</div>
|
||||
<div *ngIf="!showLoading">
|
||||
<ul class="uk-list submenu-items">
|
||||
<li class="uk-card uk-card-default uk-margin-bottom">
|
||||
<ul *ngIf='activeRootMenu' class="uk-list submenu-items">
|
||||
<li *ngFor="let child of getActiveRootItem(activeRootMenu).items" class="uk-card uk-card-default uk-margin-bottom">
|
||||
<div class="uk-grid uk-grid-divider uk-padding" uk-grid>
|
||||
<div class="uk-width-4-5">
|
||||
<div class="uk-grid uk-flex uk-flex-middle">
|
||||
|
@ -93,7 +93,7 @@
|
|||
<input type="checkbox" id="" class="checkBox" name="" value="">
|
||||
</div>
|
||||
<div class="uk-width-expand uk-margin-medium-bottom">
|
||||
Name and info
|
||||
{{child.title}}
|
||||
</div>
|
||||
<div class="uk-grid uk-width-1-1 uk-margin-left">
|
||||
Additional info
|
||||
|
|
|
@ -27,10 +27,15 @@ export class MenuComponent implements OnInit {
|
|||
|
||||
public checkboxes: CheckMenuItem[] = [];
|
||||
|
||||
public menuItems: MenuItem[] = [];
|
||||
// public menuItems: MenuItem[] = [];
|
||||
|
||||
// public rootMenuForm: FormGroup;
|
||||
|
||||
public activeRootMenu: string;
|
||||
|
||||
public menuItemForm: FormGroup;
|
||||
public rootMenuItems = [];
|
||||
public menuItems = [];
|
||||
public allPages = [];
|
||||
|
||||
public keyword = '';
|
||||
|
@ -93,12 +98,21 @@ export class MenuComponent implements OnInit {
|
|||
this._helpContentService.getMenuItems(this.portal).subscribe(
|
||||
data => {
|
||||
console.log(data);
|
||||
this.rootMenuItems = data;
|
||||
if(data && data.length > 0) {
|
||||
this.activeRootMenu = data[0]['_id'];
|
||||
console.log(this.activeRootMenu);
|
||||
}
|
||||
},
|
||||
err => console.error("Server error fetching menu items: ", err)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
getActiveRootItem(id: string): MenuItem {
|
||||
return this.rootMenuItems.find(element => element['_id'] == id);
|
||||
}
|
||||
|
||||
getPages() {
|
||||
this.subscriptions.push(
|
||||
this._helpContentService.getAllPages(this.properties.adminToolsAPIURL,this.portal).subscribe(
|
||||
|
@ -120,10 +134,10 @@ export class MenuComponent implements OnInit {
|
|||
this.menuItemForm = this._fb.group({
|
||||
id: this._fb.control(""),
|
||||
title: this._fb.control("",Validators.required),
|
||||
type: this._fb.control("",Validators.required),
|
||||
type: this._fb.control(""),
|
||||
route: this._fb.control(""),
|
||||
url: this._fb.control(""),
|
||||
isEnabled: this._fb.control("",Validators.required),
|
||||
isEnabled: this._fb.control(""),
|
||||
});
|
||||
this.menuItemsModalOpen('Create Root Menu', 'Save Changes');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue