Started restructuring the library with attacks, saves, and limited parenting

This commit is contained in:
Stefan Zermatten
2019-08-12 16:42:30 +02:00
parent 6f4710bee3
commit a8b3fc3f2f
14 changed files with 204 additions and 91 deletions

View File

@@ -1,10 +1,11 @@
<template lang="html">
<draggable
:value="children"
class="drag-area"
@change="change"
:value="children"
:group="group"
:animation="200"
:move="move"
@change="change"
ghost-class="ghost"
draggable=".item"
handle=".handle"
@@ -31,6 +32,8 @@
<script>
import draggable from 'vuedraggable';
import TreeNode from '/imports/ui/components/tree/TreeNode.vue';
import { isParentAllowed } from '/imports/api/parenting/parenting.js';
export default {
components: {
draggable,
@@ -71,6 +74,13 @@
}
}
},
move(evt){
let parentNode = evt.relatedContext.component.$parent.node
let parentType = parentNode && parentNode.type || 'root';
let childType = evt.draggedContext.element.node.type;
let allowed = isParentAllowed({parentType, childType});
return allowed;
},
},
};
</script>