This repository was archived by the owner on Jan 3, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +34
-40
lines changed
resources/assets/js/components Expand file tree Collapse file tree 4 files changed +34
-40
lines changed Original file line number Diff line number Diff line change @@ -17,9 +17,11 @@ trait MenuOps
17
17
*/
18
18
public function getMenuPages ($ id )
19
19
{
20
- $ pages = $ this ->cache ->tags ('sm ' )->get ('menus ' )->find ($ id )->pages ()->orderBy ('pivot_order ' , 'asc ' )->get ()->each (function ($ item ) {
21
- $ item ['from ' ] = 'pages ' ;
22
- });
20
+ $ pages = collect ($ this ->cache ->tags ('sm ' )->get ('menus ' )->find ($ id )->pages )
21
+ ->sortBy ('pivot_order ' )
22
+ ->each (function ($ item ) {
23
+ $ item ['from ' ] = 'pages ' ;
24
+ });
23
25
24
26
$ allPages = $ this ->cache ->tags ('sm ' )->get ('pages ' )->diff ($ pages )->each (function ($ item ) {
25
27
$ item ['from ' ] = 'allPages ' ;
Original file line number Diff line number Diff line change @@ -19,6 +19,9 @@ export default {
19
19
created () {
20
20
this .getPages ()
21
21
},
22
+ updated () {
23
+ admin_sticky_sidebar ()
24
+ },
22
25
methods: {
23
26
getPages () {
24
27
$ .get (this .getMenuPages , (res ) => {
@@ -63,14 +66,6 @@ export default {
63
66
this .allPages = res .allPages .filter ((x ) => this .pages .indexOf (x) < 0 )
64
67
})
65
68
})
66
-
67
- EventHub .listen (' childDragStart' , () => {
68
- this .isDragging = true
69
- })
70
-
71
- EventHub .listen (' childDragEnd' , () => {
72
- this .isDragging = false
73
- })
74
69
},
75
70
76
71
// styling
@@ -87,14 +82,6 @@ export default {
87
82
},
88
83
89
84
// nests
90
- dragStart () {
91
- this .isDragging = true
92
- EventHub .fire (' parentDragStart' )
93
- },
94
- dragEnd () {
95
- this .isDragging = false
96
- EventHub .fire (' parentDragEnd' )
97
- },
98
85
loop (item ) {
99
86
let childs = []
100
87
Original file line number Diff line number Diff line change @@ -78,15 +78,6 @@ export default {
78
78
pushBackToList (item ) {
79
79
return item .from == ' pages' ? this .pages .unshift (item) : this .allPages .unshift (item)
80
80
},
81
- eventsListeners () {
82
- EventHub .listen (' parentDragStart' , () => {
83
- this .isDragging = true
84
- })
85
-
86
- EventHub .listen (' parentDragEnd' , () => {
87
- this .isDragging = false
88
- })
89
- },
90
81
91
82
// styling
92
83
updateList (e ) {
@@ -100,16 +91,6 @@ export default {
100
91
if (e .moved || e .removed || e .added && e .added .element .from == ' allPages' ) {
101
92
EventHub .fire (' updatePagesHierarchy' )
102
93
}
103
- },
104
-
105
- // nests
106
- dragStart () {
107
- this .isDragging = true
108
- EventHub .fire (' childDragStart' )
109
- },
110
- dragEnd () {
111
- this .isDragging = false
112
- EventHub .fire (' childDragEnd' )
113
94
}
114
95
}
115
96
}
Original file line number Diff line number Diff line change @@ -15,6 +15,22 @@ export default {
15
15
16
16
return title . hasOwnProperty ( locale ) ? Object . values ( title ) [ v ] : Object . values ( title ) [ 0 ] . concat ( ` "${ Object . keys ( title ) [ 0 ] } "` )
17
17
} ,
18
+
19
+ // ops
20
+ eventsListeners ( ) {
21
+ EventHub . listen ( 'DragStart' , ( ) => {
22
+ this . isDragging = true
23
+ } )
24
+
25
+ EventHub . listen ( 'DragEnd' , ( ) => {
26
+ this . isDragging = false
27
+ } )
28
+ } ,
29
+ hasChilds ( item ) {
30
+ return item . nests && item . nests . length > 0
31
+ } ,
32
+
33
+ // style
18
34
classObj ( item ) {
19
35
if ( this . checkFrom ( item ) ) {
20
36
return 'is-warning'
@@ -30,8 +46,16 @@ export default {
30
46
31
47
return 'fa-caret-right'
32
48
} ,
33
- hasChilds ( item ) {
34
- return item . nests && item . nests . length > 0
49
+
50
+ // nests
51
+ dragStart ( ) {
52
+ this . isDragging = true
53
+ EventHub . fire ( 'DragStart' )
54
+ } ,
55
+ dragEnd ( ) {
56
+ this . isDragging = false
57
+ EventHub . fire ( 'DragEnd' )
35
58
}
59
+
36
60
}
37
61
}
You can’t perform that action at this time.
0 commit comments