Added skill dialog
This commit is contained in:
78
app/imports/ui/components/SkillDialogContainer.vue
Normal file
78
app/imports/ui/components/SkillDialogContainer.vue
Normal file
@@ -0,0 +1,78 @@
|
||||
<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>
|
||||
Reference in New Issue
Block a user