Began implementing features that change stats
This commit is contained in:
@@ -17,5 +17,8 @@
|
||||
<div id="stats" class="flexItem">
|
||||
{{> characterStats}}
|
||||
</div>
|
||||
<div>
|
||||
{{> features}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
8
rpg-docs/client/views/character/features.html
Normal file
8
rpg-docs/client/views/character/features.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<template name="features">
|
||||
{{#each features}}
|
||||
<li><strong>{{name}}</strong><input class="enabled" type="checkbox" checked={{enabled}}><br>
|
||||
{{# each effects}}
|
||||
{{stat}}: {{value}}
|
||||
{{/each}}</li>
|
||||
{{/each}}
|
||||
</template>
|
||||
20
rpg-docs/client/views/character/features.js
Normal file
20
rpg-docs/client/views/character/features.js
Normal file
@@ -0,0 +1,20 @@
|
||||
Template.features.helpers = {
|
||||
features: function(){
|
||||
var features = Features.find({character: this._id});
|
||||
console.log('found: ', features);
|
||||
return features;
|
||||
}
|
||||
}
|
||||
|
||||
Template.features.events = {
|
||||
// Fires when any element is clicked
|
||||
'change .enabled': function (event) {
|
||||
var enable = event.target.checked
|
||||
Features.update(this._id, {$set: {enabled: enable}});
|
||||
if(enable){
|
||||
Template.parentData(1).pushEffects(this.name, this.effects);
|
||||
} else {
|
||||
Template.parentData(1).pullEffects(this.effects);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user