Started work on tabletop view
This commit is contained in:
63
app/imports/ui/tabletop/SelectCreaturesDialog.vue
Normal file
63
app/imports/ui/tabletop/SelectCreaturesDialog.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<template lang="html">
|
||||
<dialog-base>
|
||||
<v-toolbar-title slot="toolbar">
|
||||
Add Characters
|
||||
</v-toolbar-title>
|
||||
<v-list>
|
||||
<creature-list-tile
|
||||
v-for="creature in creatures"
|
||||
:key="creature._id"
|
||||
:model="creature"
|
||||
:selected="selected"
|
||||
selection
|
||||
@select="toggleSelect(creature._id)"
|
||||
/>
|
||||
</v-list>
|
||||
<template slot="actions">
|
||||
<v-spacer />
|
||||
<v-btn
|
||||
flat
|
||||
color="primary"
|
||||
@click="$store.dispatch('popDialogStack', selected)"
|
||||
>
|
||||
Add characters
|
||||
</v-btn>
|
||||
</template>
|
||||
</dialog-base>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import DialogBase from '/imports/ui/dialogStack/DialogBase.vue';
|
||||
import Creatures from '/imports/api/creature/Creatures.js';
|
||||
import CreatureListTile from '/imports/ui/creature/CreatureListTile.vue';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
DialogBase,
|
||||
CreatureListTile,
|
||||
},
|
||||
props: {
|
||||
startingSelection: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data(){return {
|
||||
selected: new Set(this.startingSelection),
|
||||
}},
|
||||
meteor: {
|
||||
creatures(){
|
||||
return Creatures.find({});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
toggleSelect(id){
|
||||
let hadId = this.selected.delete(id);
|
||||
if (!hadId) this.selected.add(id);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="css" scoped>
|
||||
</style>
|
||||
Reference in New Issue
Block a user