root menu

master
Boris Voropaev 2023-11-21 15:58:10 +03:00
parent d36ed2f411
commit d699ca3f28
8 changed files with 20 additions and 22 deletions

View File

@ -14,6 +14,11 @@ export class HeaderComponent {
public pagesService: PagesService
) {
}
// ngOnInit(){
// this.pagesService.root().subscribe(
// resp=> this.pagesService.rootPage = resp
// )
// }
get rootPage() {
return this.pagesService.rootPage;

View File

@ -1,6 +1,4 @@
import {Component} from '@angular/core';
import {Router} from "@angular/router";
import {PagesService} from "@app/_services/pages.service";
@Component({
selector: 'left-content',
@ -9,20 +7,6 @@ import {PagesService} from "@app/_services/pages.service";
})
export class LeftContentComponent {
constructor(
private router: Router,
public pagesService: PagesService
) {
}
get rootPage() {
return this.pagesService.rootPage;
}
openMobileMenu(){
this.router.navigate([{outlets: {slider: 'pages-menu'}}], {skipLocationChange: true}).then();
}
}

View File

@ -28,7 +28,7 @@ export class PagesMenuItemComponent {
}
get current(){
return this.item.link == this.pagesService.currentPage.link
return this.item.link == this.pagesService.currentPage?.link
}
get selected(){
@ -36,7 +36,7 @@ export class PagesMenuItemComponent {
}
get parent(){
return !this.current && this.pagesService.currentPage.link.startsWith(this.item.link)
return !this.current && this.pagesService.currentPage?.link.startsWith(this.item.link)
}
get nav(){

View File

@ -27,6 +27,7 @@ export class PagesMenuComponent implements OnInit {
this.pagesService.rootPageSubject
]).subscribe(
resp=>{
console.log(resp)
let [currentPage, rootPage] = resp
if(currentPage){
let menuTree = currentPage.parents.data.reduceRight(
@ -39,6 +40,7 @@ export class PagesMenuComponent implements OnInit {
}, currentPage);
this.items = menuTree.children.data;
}else{
console.log(rootPage)
this.items = rootPage?.data[0].children.data
}
}

View File

@ -71,7 +71,7 @@
}
.carousel {
width: 100%;
display: flex;
align-items: center;
justify-content:center;

View File

@ -17,8 +17,9 @@ export class LocaleComponent {
){}
ngOnInit() {
this.pagesService.root().subscribe(res => {
this.pagesService.root({include:'children'}).subscribe(res => {
this.locales = res.data;
this.pagesService.rootPage = res
});
}

View File

@ -19,7 +19,7 @@
// }
.toggle-hide{
visibility: collapse;
display: none;
}
.inline{

View File

@ -6,20 +6,26 @@ add-section{
display: flex;
gap:8px;
align-items: center;
padding-bottom: 8px;
drop-down{
margin-top: 4px;
}
&.active{
a{
color: var(--prime-act);
}
}
}
.dropdown{
left:48px;
top:32px;
}
}
}
.cards-section-items{
cards-section-items{
.items {
display: flex;
flex-direction: row;