drag/drop bug
parent
ffcb177f5c
commit
28de41a911
|
|
@ -1,4 +1,5 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {PagesService} from "@app/_services/pages.service";
|
||||
|
||||
@Component({
|
||||
selector: 'administrate-site-pages',
|
||||
|
|
@ -6,10 +7,22 @@ import {Component} from '@angular/core';
|
|||
styleUrls: ['administrate-site-pages.component.scss']
|
||||
})
|
||||
export class AdministrateSitePagesComponent {
|
||||
constructor() {
|
||||
}
|
||||
constructor(
|
||||
private pagesService: PagesService
|
||||
) {}
|
||||
|
||||
public mainPage:any;
|
||||
|
||||
ngOnInit() {
|
||||
this.fetchRootPages()
|
||||
}
|
||||
|
||||
fetchRootPages() {
|
||||
let include = ['children','parent'];
|
||||
this.pagesService.root({include: include}).subscribe(res => {
|
||||
this.mainPage = res.data;
|
||||
console.log('MAIN', this.mainPage)
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export class PagesTreeComponent {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.log('parent',this.parent)
|
||||
if (!this.parent) this.subscription = this.listsService.controls(this.listId).subscribe(res => {
|
||||
this.fetch();
|
||||
});
|
||||
|
|
@ -74,6 +75,10 @@ export class PagesTreeComponent {
|
|||
|
||||
|
||||
move(event: any) {
|
||||
console.log('Move',event)
|
||||
console.log(parent)
|
||||
console.log(event.item.id)
|
||||
console.log({parent: this.parent?.id, ord: event.newIndex})
|
||||
this.pagesService.move(event.item.id, {parent: this.parent?.id, ord: event.newIndex}).subscribe(res => {
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue