logo link
parent
ec84a76796
commit
b5e999d7d9
|
|
@ -16,7 +16,7 @@ export class HeaderComponent {
|
|||
}
|
||||
// ngOnInit(){
|
||||
// this.pagesService.root().subscribe(
|
||||
// resp=> this.pagesService.rootPage = resp
|
||||
// resp=> this.pagesService.rootPages = resp
|
||||
// )
|
||||
// }
|
||||
|
||||
|
|
@ -27,5 +27,4 @@ export class HeaderComponent {
|
|||
openMobileMenu(){
|
||||
this.router.navigate([{outlets: {slider: 'pages-menu'}}], {skipLocationChange: true}).then();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -24,10 +24,10 @@ export class PagesMenuComponent implements OnInit {
|
|||
|
||||
this.subscription = combineLatest([
|
||||
this.pagesService.currentPageSubject,
|
||||
this.pagesService.rootPageSubject
|
||||
this.pagesService.rootPagesSubject
|
||||
]).subscribe(
|
||||
resp=>{
|
||||
let [currentPage, rootPage] = resp
|
||||
let [currentPage, rootPages] = resp
|
||||
if(currentPage){
|
||||
let menuTree = currentPage.parents.data.reduceRight(
|
||||
(menuTree,item)=>{
|
||||
|
|
@ -39,7 +39,7 @@ export class PagesMenuComponent implements OnInit {
|
|||
}, currentPage);
|
||||
this.items = menuTree.children.data;
|
||||
}else{
|
||||
this.items = rootPage?.data[0].children.data
|
||||
this.items = rootPages?.data[0].children.data
|
||||
}
|
||||
}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<slider [width]="'320px'" side="left">
|
||||
|
||||
<div body>
|
||||
<pages-menu *ngIf="rootPage" [root]="rootPage" class="top-menu"></pages-menu>
|
||||
<pages-menu *ngIf="rootPages" [root]="rootPages" class="top-menu"></pages-menu>
|
||||
<div class="btn-menu">
|
||||
<div>
|
||||
<a>!!!</a>
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ export class SliderMenuComponent {
|
|||
) {
|
||||
}
|
||||
|
||||
get rootPage() {
|
||||
return this.pagesService.rootPage;
|
||||
get rootPages() {
|
||||
return this.pagesService.rootPages;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export class LocaleComponent {
|
|||
){}
|
||||
|
||||
ngOnInit() {
|
||||
this.pagesService.rootPageSubject.subscribe(
|
||||
this.pagesService.rootPagesSubject.subscribe(
|
||||
|
||||
res=>{
|
||||
console.log(res)
|
||||
|
|
@ -32,8 +32,13 @@ export class LocaleComponent {
|
|||
this.rootSubscription.unsubscribe()
|
||||
}
|
||||
|
||||
get rootPage() {
|
||||
return this.pagesService.rootPage;
|
||||
|
||||
get rootPage(){
|
||||
return this.pagesService.rootPage
|
||||
}
|
||||
|
||||
get rootPages() {
|
||||
return this.pagesService.rootPages;
|
||||
}
|
||||
|
||||
flag(localeName:string){
|
||||
|
|
|
|||
|
|
@ -7,29 +7,30 @@ import {Observable, BehaviorSubject} from "rxjs";
|
|||
@Injectable({providedIn: 'root'})
|
||||
export class PagesService {
|
||||
public currentPageSubject = new BehaviorSubject<any>(null);
|
||||
public rootPageSubject = new BehaviorSubject<any>(null);
|
||||
public rootPagesSubject = new BehaviorSubject<any>(null);
|
||||
public metaSubject = new BehaviorSubject<any>({title: '', description: '', keywords: ''});
|
||||
public editModeSubject = new BehaviorSubject<boolean>(false);
|
||||
public showDeletedSubject = new BehaviorSubject<boolean>(false);
|
||||
public menuSelectedLink: string;
|
||||
|
||||
constructor(private http: HttpClient) {
|
||||
//this.find('/').subscribe(res => {this.rootPage = res.data});
|
||||
//this.find('/').subscribe(res => {this.rootPages = res.data});
|
||||
}
|
||||
rootPage:any
|
||||
|
||||
get currentPage() {
|
||||
return this.currentPageSubject.value;
|
||||
}
|
||||
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() {
|
||||
return this.rootPageSubject.value;
|
||||
get rootPages() {
|
||||
return this.rootPagesSubject.value;
|
||||
}
|
||||
set rootPage(val: any) {
|
||||
this.rootPageSubject.next(val);
|
||||
set rootPages(val: any) {
|
||||
this.rootPagesSubject.next(val);
|
||||
}
|
||||
|
||||
get editMode() {
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@ export class AppComponent {
|
|||
|
||||
ngOnInit() {
|
||||
this.rootSubscription = this.pagesService.root({include:'children'}).subscribe(res => {
|
||||
this.pagesService.rootPage = res
|
||||
this.pagesService.rootPages = res
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscription?.unsubscribe();
|
||||
this.rootSubscription.unsubscribe()
|
||||
|
|
|
|||
Loading…
Reference in New Issue