diff --git a/src/app/_modules/layout/header/header.component.ts b/src/app/_modules/layout/header/header.component.ts
index 41bde48..6be8ce9 100644
--- a/src/app/_modules/layout/header/header.component.ts
+++ b/src/app/_modules/layout/header/header.component.ts
@@ -53,7 +53,7 @@ export class HeaderComponent {
fetchMenu() {
- let include = ['children.children.children.children'];
+ let include = ['children.children.children.children','parents','children.parents'];
this.pagesService.root({include: include.join(',')}).subscribe(res => {
this.menuItems = res.data;
});
diff --git a/src/app/_modules/pages/menu/item/pages-menu-item.component.html b/src/app/_modules/pages/menu/item/pages-menu-item.component.html
index d8d32d2..c30c1d9 100644
--- a/src/app/_modules/pages/menu/item/pages-menu-item.component.html
+++ b/src/app/_modules/pages/menu/item/pages-menu-item.component.html
@@ -1,6 +1,6 @@
-=3?null:item.link" routerLinkActive="active" (click)="select(item)"
+{{item.name}}
1 && this.item.parents?.data.length==1 )?null:this.item.link
+ }
+
ngOnInit() {
}
diff --git a/src/app/_modules/pages/menu/pages-menu.component.ts b/src/app/_modules/pages/menu/pages-menu.component.ts
index c2dd6ef..d063407 100644
--- a/src/app/_modules/pages/menu/pages-menu.component.ts
+++ b/src/app/_modules/pages/menu/pages-menu.component.ts
@@ -30,12 +30,15 @@ export class PagesMenuComponent {
}
getDepth(item){
+ if (item.hasOwnProperty('depth')) return item.depth
if (!item.hasOwnProperty('depth')) item.depth=0;
- if (item.children?.data.length) item.depth = 1;
- item.children?.data.forEach(child => {
- let childDepth = this.getDepth(child)
- if (childDepth>=item.depth) item.depth=childDepth+1;
- });
+ if (item.children?.data.length) {
+ item.depth = 1;
+ item.children.data.forEach(child => {
+ let childDepth = this.getDepth(child)
+ if (childDepth>=item.depth) item.depth=childDepth+1;
+ });
+ }
return item.depth
}
}
\ No newline at end of file
diff --git a/src/app/_modules/pages/page/page.component.html b/src/app/_modules/pages/page/page.component.html
index d3eae0d..c5cf7d1 100644
--- a/src/app/_modules/pages/page/page.component.html
+++ b/src/app/_modules/pages/page/page.component.html
@@ -7,7 +7,7 @@
-
{{pageTopName}}
+ {{pageTopName}}
@@ -31,7 +31,7 @@
diff --git a/src/app/_modules/pages/page/page.component.ts b/src/app/_modules/pages/page/page.component.ts
index ee91bea..2421246 100644
--- a/src/app/_modules/pages/page/page.component.ts
+++ b/src/app/_modules/pages/page/page.component.ts
@@ -15,6 +15,8 @@ export class PageComponent {
public menuItems:any[]
private url: string;
private inited = false;
+ public subMenu:any;
+ public pageTopName:string;
routeSubscription?: Subscription;
subscription: Subscription;
@@ -38,24 +40,11 @@ export class PageComponent {
return this.permissions?.edit || this.permissions?.anything;
}
- get pageTopName(){
- let item:any;
- let name:string
- if(this.menuItems){
- item = this.menuItems.find(item=>this.page.link.startsWith(item.link))
- name= item?.name;
- if (item?.depth>=2){
- item = item.children.data.find(item=>this.page.link.startsWith(item.link))
- name= item?.name;
- }
- }
- return name;
- }
ngAfterContentInit() {
this.listsService.controls().subscribe(res => {
this.inited ? this.fetch() : this.inited = true;
- this.fetchMenu();
+
});
}
@@ -88,6 +77,7 @@ export class PageComponent {
this.pagesService.find(this.url, {include: include.join(',')}).subscribe(res => {
this.page = res?.data;
this.loading = false;
+ this.fetchMenu();
}, error => {
this.loading = false;
});
@@ -97,6 +87,17 @@ export class PageComponent {
let include = ['children.children.children.children'];
this.pagesService.root({include: include.join(',')}).subscribe(res => {
this.menuItems = res.data;
+ let topItem:any = null;
+ this.subMenu = [];
+ this.pageTopName = this.page.name;
+
+ topItem = this.menuItems.find(item=>this.page.link.startsWith(item.link));
+ this.subMenu = topItem?.children.data;
+ this.pageTopName = topItem?.name || this.pageTopName;
+
+ topItem = this.subMenu?.find(item=>this.page.link.startsWith(item.link));
+ this.pageTopName = topItem?.name || this.pageTopName;
+ this.subMenu = topItem?.children.data
});
}
diff --git a/src/assets/css/main-menu.scss b/src/assets/css/main-menu.scss
index 1ee8c69..054cde3 100644
--- a/src/assets/css/main-menu.scss
+++ b/src/assets/css/main-menu.scss
@@ -122,7 +122,7 @@
font-style: normal;
font-weight: 400;
line-height: 32px;
- &.current-item{
+ &.parent-item{
>span{
display: inline-block;
border-bottom: 2px solid #0070BA;
@@ -179,23 +179,29 @@
}
.sub-menu{
- pages-menu {
- display: block;
- }
a{
display: block;
padding: 10px 20px;
- }
- >pages-menu {
- display: flex;
- flex-direction: column;
+ }
+
+ >pages-menu{
+ display: block;
+ padding: 20px;
+ border-radius: 8px;
+ background: #FFF;
+ box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.27);
+
+
>pages-menu-item{
- >a{
- display: none;
- };
+
+
+
+ >a.active>span{
+ color: var(--blue-1)
+ }
+
a{
span{
-
color: #6C6C6C;
font-family: PT Sans Narrow;
font-size: 24px;
@@ -203,77 +209,41 @@
font-weight: 700;
line-height: 32px; /* 133.333% */
letter-spacing: 0.24px;
-
}
}
+
:hover{
color:var(--blue-2)
}
.current-item{
color:var(--blue-1)
}
- >pages-menu{
- padding: 20px;
- border-radius: 8px;
- background: #FFF;
- box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.27);
- }
- >pages-menu:not(.parent-item){
- display: none;
- }
- }
- >pages-menu-item.depth{
- >pages-menu{
-
+ >pages-menu.parent-item{ //second level
+ display: block;
>pages-menu-item{
- >a{display: none;}
- pages-menu{
- display: none;
- &.parent-item{
-
- display: block;
+ >a{
+
+ >span{
+ font-size: 20px;
+ font-family: PT Sans;
+ font-style: normal;
+ font-weight: 400;
+ line-height: 24px;
}
-
}
-
- >pages-menu{ //first level
- >pages-menu-item{
- >a.active>span{
- color: var(--blue-1)
- }
-
- >pages-menu{ //second level
- >pages-menu-item{
- >a{
-
- >span{
- font-size: 20px;
- font-family: PT Sans;
- font-style: normal;
- font-weight: 400;
- line-height: 24px;
- }
- }
- >a.active{
- background-color: #EDEDED;
- border-radius: 8px;
- span{
- color:#2D2D2D
- }
- }
- }
- }
+ >a.active{
+ background-color: #EDEDED;
+ border-radius: 8px;
+ span{
+ color:#2D2D2D
}
}
}
-
}
-
}
-
-
}
+
}
}
\ No newline at end of file