Files
DiceCloud/app/imports/ui/components/SkillDialogContainer.vue
Stefan Zermatten da6909a997 Added skill dialog
2019-02-19 11:12:37 +02:00

79 lines
1.7 KiB
Vue

<template lang="html">
<skill-dialog
v-bind="skill"
:effects="effects"
:proficiencies="proficiencies"
:abilityDoc="abilityDoc"
v-on="{clickedEffect, clickedProficiency, change}"
/>
</template>
<script>
import SkillDialog from '/imports/ui/components/SkillDialog.vue';
import Skills from '/imports/api/creature/properties/Skills.js';
import { updateSkill } from '/imports/api/creature/properties/Skills.js';
import Attributes from '/imports/api/creature/properties/Attributes.js';
import Effects from '/imports/api/creature/properties/Effects.js';
import Proficiencies from '/imports/api/creature/properties/Proficiencies.js';
export default {
components: {
SkillDialog,
},
props: {
_id: String,
},
meteor: {
skill(){
return Skills.findOne(this._id);
},
abilityDoc(){
return this.skill && Attributes.findOne({
variableName: this.skill.ability,
});
},
effects(){
if (!this.skill) return;
let charId = this.skill.charId;
let stat = this.skill.variableName;
return Effects.find({
charId,
stat,
enabled: true,
}, {
sort: {order: 1},
}).fetch();
},
proficiencies(){
if (!this.skill) return;
let charId = this.skill.charId;
let stat = this.skill.variableName;
return Proficiencies.find({
charId,
stat,
enabled: true,
}, {
sort: {order: 1},
}).fetch();
},
},
methods: {
clickedEffect(e){
console.log(e);
},
clickedProficiency(e){
console.log(e);
},
change(update, ack){
updateSkill.call({_id: this._id, update}, error => {
ack(error);
});
},
}
};
</script>
<style lang="css" scoped>
</style>