root Pages
parent
e4f401a66d
commit
ec84a76796
|
|
@ -27,7 +27,6 @@ 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(
|
||||
|
|
@ -40,7 +39,6 @@ export class PagesMenuComponent implements OnInit {
|
|||
}, currentPage);
|
||||
this.items = menuTree.children.data;
|
||||
}else{
|
||||
console.log(rootPage)
|
||||
this.items = rootPage?.data[0].children.data
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ export class ImagesSectionComponent {
|
|||
return type.name;
|
||||
}
|
||||
get imageClass(){
|
||||
console.log(this.imageType)
|
||||
return {
|
||||
small : this.imageType=='tiles',
|
||||
large : this.imageType=='full-width',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { Component } from '@angular/core';
|
||||
import {PagesService} from "@app/_services/pages.service";
|
||||
import { environment } from '@environments/environment';
|
||||
import {Subscription} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'locale',
|
||||
|
|
@ -11,16 +12,24 @@ export class LocaleComponent {
|
|||
|
||||
public locales = <any>[];
|
||||
public ddMenu:boolean;
|
||||
private rootSubscription: Subscription
|
||||
|
||||
constructor(
|
||||
public pagesService: PagesService
|
||||
){}
|
||||
|
||||
ngOnInit() {
|
||||
this.pagesService.root({include:'children'}).subscribe(res => {
|
||||
this.locales = res.data;
|
||||
this.pagesService.rootPage = res
|
||||
});
|
||||
this.pagesService.rootPageSubject.subscribe(
|
||||
|
||||
res=>{
|
||||
console.log(res)
|
||||
this.locales = res?.data
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.rootSubscription.unsubscribe()
|
||||
}
|
||||
|
||||
get rootPage() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ export class PagesService {
|
|||
}
|
||||
set currentPage(val: any) {
|
||||
this.currentPageSubject.next(val);
|
||||
this.rootPage = val?.parents?.data[0] || val;
|
||||
// this.rootPage = val?.parents?.data[0] || val;
|
||||
this.setMetaFromPage(val);
|
||||
}
|
||||
get rootPage() {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {Subscription} from "rxjs";
|
|||
styleUrls: ['app.component.scss']})
|
||||
export class AppComponent {
|
||||
public subscription: Subscription;
|
||||
private rootSubscription: Subscription
|
||||
|
||||
constructor(private authService: AuthenticationService, private pagesService: PagesService, private titleService: Title, private metaService: Meta) {
|
||||
authService.checkUser();
|
||||
|
|
@ -18,8 +19,15 @@ export class AppComponent {
|
|||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.rootSubscription = this.pagesService.root({include:'children'}).subscribe(res => {
|
||||
this.pagesService.rootPage = res
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscription?.unsubscribe();
|
||||
this.rootSubscription.unsubscribe()
|
||||
}
|
||||
|
||||
applyMetaData(data: any) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue