Fixed spells not persisting checkbox values
This commit is contained in:
@@ -1,67 +1,98 @@
|
||||
<template lang="html">
|
||||
<dialog-base>
|
||||
<template slot="toolbar">
|
||||
<property-icon :type="model.type" class="mr-2"/>
|
||||
<div class="title">
|
||||
{{model.name || getPropertyName(model.type)}}
|
||||
</div>
|
||||
<v-spacer/>
|
||||
<v-menu v-if="editing" bottom left transition="slide-y-transition">
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn icon v-on="on">
|
||||
<v-icon>more_vert</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-tile @click="remove">
|
||||
<v-list-tile-title>
|
||||
Delete <v-icon>delete</v-icon>
|
||||
</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-btn icon @click="editing = !editing">
|
||||
<v-slide-y-transition leave-absolute mode="out-in">
|
||||
<v-icon v-if="editing" key="doneIcon">done</v-icon>
|
||||
<v-icon v-else key="createIcon">create</v-icon>
|
||||
</v-slide-y-transition>
|
||||
</v-btn>
|
||||
</template>
|
||||
<template v-if="model">
|
||||
<component
|
||||
v-if="editing"
|
||||
class="creature-property-form"
|
||||
:is="model.type + 'Form'"
|
||||
:model="model"
|
||||
@change="change"
|
||||
@push="push"
|
||||
@pull="pull"
|
||||
/>
|
||||
<component
|
||||
v-else-if="!editing && $options.components[model.type + 'Viewer']"
|
||||
class="creature-property-viewer"
|
||||
:is="model.type + 'Viewer'"
|
||||
:model="model"
|
||||
/>
|
||||
<p v-else>This property can't be viewed yet.</p>
|
||||
<template v-if="!editing">
|
||||
<v-divider/>
|
||||
<creature-properties-tree
|
||||
v-if="!editing"
|
||||
:root="{collection: 'creatureProperties', id: model._id}"
|
||||
@selected="selectSubProperty"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
<div
|
||||
slot="actions"
|
||||
class="layout row justify-end"
|
||||
>
|
||||
<v-btn
|
||||
flat
|
||||
@click="$store.dispatch('popDialogStack')"
|
||||
>Done</v-btn>
|
||||
</div>
|
||||
<dialog-base>
|
||||
<template slot="toolbar">
|
||||
<property-icon
|
||||
:type="model.type"
|
||||
class="mr-2"
|
||||
/>
|
||||
<div class="title">
|
||||
{{ model.name || getPropertyName(model.type) }}
|
||||
</div>
|
||||
<v-spacer />
|
||||
<v-menu
|
||||
v-if="editing"
|
||||
bottom
|
||||
left
|
||||
transition="slide-y-transition"
|
||||
>
|
||||
<template #activator="{ on }">
|
||||
<v-btn
|
||||
icon
|
||||
v-on="on"
|
||||
>
|
||||
<v-icon>more_vert</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<v-list>
|
||||
<v-list-tile @click="remove">
|
||||
<v-list-tile-title>
|
||||
Delete <v-icon>delete</v-icon>
|
||||
</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
</v-menu>
|
||||
<v-btn
|
||||
icon
|
||||
@click="editing = !editing"
|
||||
>
|
||||
<v-slide-y-transition
|
||||
leave-absolute
|
||||
mode="out-in"
|
||||
>
|
||||
<v-icon
|
||||
v-if="editing"
|
||||
key="doneIcon"
|
||||
>
|
||||
done
|
||||
</v-icon>
|
||||
<v-icon
|
||||
v-else
|
||||
key="createIcon"
|
||||
>
|
||||
create
|
||||
</v-icon>
|
||||
</v-slide-y-transition>
|
||||
</v-btn>
|
||||
</template>
|
||||
<template v-if="model">
|
||||
<component
|
||||
:is="model.type + 'Form'"
|
||||
v-if="editing"
|
||||
class="creature-property-form"
|
||||
:model="model"
|
||||
@change="change"
|
||||
@push="push"
|
||||
@pull="pull"
|
||||
/>
|
||||
<component
|
||||
:is="model.type + 'Viewer'"
|
||||
v-else-if="!editing && $options.components[model.type + 'Viewer']"
|
||||
class="creature-property-viewer"
|
||||
:model="model"
|
||||
/>
|
||||
<p v-else>
|
||||
This property can't be viewed yet.
|
||||
</p>
|
||||
<template v-if="!editing">
|
||||
<v-divider />
|
||||
<creature-properties-tree
|
||||
v-if="!editing"
|
||||
:root="{collection: 'creatureProperties', id: model._id}"
|
||||
@selected="selectSubProperty"
|
||||
/>
|
||||
</template>
|
||||
</template>
|
||||
<div
|
||||
slot="actions"
|
||||
class="layout row justify-end"
|
||||
>
|
||||
<v-btn
|
||||
flat
|
||||
@click="$store.dispatch('popDialogStack')"
|
||||
>
|
||||
Done
|
||||
</v-btn>
|
||||
</div>
|
||||
</dialog-base>
|
||||
</template>
|
||||
|
||||
@@ -117,7 +148,7 @@ export default {
|
||||
if (!this.model) return;
|
||||
let nearestCreatureAncestor = findLast(
|
||||
this.model.ancestors,
|
||||
ref => ref.collection === "creatures"
|
||||
ref => ref.collection === 'creatures'
|
||||
);
|
||||
if (!nearestCreatureAncestor) return;
|
||||
return Creatures.findOne(nearestCreatureAncestor.id);
|
||||
@@ -131,11 +162,13 @@ export default {
|
||||
getPropertyName,
|
||||
change({path, value, ack}){
|
||||
updateProperty.call({_id: this._id, path, value}, (error, result) =>{
|
||||
if (error) console.warn(error);
|
||||
ack && ack(error && error.reason || error);
|
||||
});
|
||||
},
|
||||
push({path, value, ack}){
|
||||
pushToProperty.call({_id: this._id, path, value}, (error, result) =>{
|
||||
if (error) console.warn(error);
|
||||
ack && ack(error && error.reason || error);
|
||||
});
|
||||
},
|
||||
@@ -143,6 +176,7 @@ export default {
|
||||
let itemId = get(this.model, path)._id;
|
||||
path.pop();
|
||||
pullFromProperty.call({_id: this._id, path, itemId}, (error, result) =>{
|
||||
if (error) console.warn(error);
|
||||
ack && ack(error && error.reason || error);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -56,25 +56,25 @@
|
||||
<div class="layout row wrap justify-space-between">
|
||||
<v-checkbox
|
||||
label="Verbal"
|
||||
:value="model.verbal"
|
||||
:input-value="model.verbal"
|
||||
:error-messages="errors.verbal"
|
||||
@change="(value) => $emit('change', {path: ['verbal'], value})"
|
||||
@change="(value) => log(value)/*$emit('change', {path: ['verbal'], value})*/"
|
||||
/>
|
||||
<v-checkbox
|
||||
label="Somatic"
|
||||
:value="model.somatic"
|
||||
:input-value="model.somatic"
|
||||
:error-messages="errors.somatic"
|
||||
@change="(value) => $emit('change', {path: ['somatic'], value})"
|
||||
/>
|
||||
<v-checkbox
|
||||
label="Concentration"
|
||||
:value="model.concentration"
|
||||
:input-value="model.concentration"
|
||||
:error-messages="errors.concentration"
|
||||
@change="(value) => $emit('change', {path: ['concentration'], value})"
|
||||
/>
|
||||
<v-checkbox
|
||||
label="Ritual"
|
||||
:value="model.ritual"
|
||||
:input-value="model.ritual"
|
||||
:error-messages="errors.ritual"
|
||||
@change="(value) => $emit('change', {path: ['ritual'], value})"
|
||||
/>
|
||||
@@ -213,6 +213,9 @@
|
||||
},
|
||||
],
|
||||
};},
|
||||
methods: {
|
||||
log: console.log,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user