-
Notifications
You must be signed in to change notification settings - Fork 2
/
js.js
31 lines (31 loc) · 854 Bytes
/
js.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$(document).ready(function() {
var vm = new Vue({
el: 'body',
data: {
contentComponents: [1],
components: [1,2],
movingIndex: null
},
ready: function() {
$( "#components_list, #content_components_list" ).sortable({
connectWith: "#content_components_list",
placeholder: "placeholder",
remove: function(e,li) {
vm.contentComponents.splice(li.item.index(), 0, vm.components[vm.movingIndex]);
$(this).sortable('cancel');
},
start: function(evt, ui) {
vm.movingIndex = ui.item.index();
},
}).disableSelection();
},
methods: {
removeComponent: function(component) {
this.contentComponents.$remove(component);
},
editComponent: function(component) {
alert("Pendiente");
}
}
})
});