Fixed incorrectly defined helpers, added item routes
This commit is contained in:
@@ -7,4 +7,5 @@ Item = function(name, container){
|
|||||||
this.weight = 0.0;
|
this.weight = 0.0;
|
||||||
this.value = 0;//value in gold pieces
|
this.value = 0;//value in gold pieces
|
||||||
this.description = "";
|
this.description = "";
|
||||||
|
this.effects = [];
|
||||||
}
|
}
|
||||||
@@ -15,9 +15,37 @@ Router.map( function () {
|
|||||||
data: function() {
|
data: function() {
|
||||||
var data = Characters.findOne({_id: this.params._id});
|
var data = Characters.findOne({_id: this.params._id});
|
||||||
data.features = Features.find({character: data._id});
|
data.features = Features.find({character: data._id});
|
||||||
|
data.containers = Containers.find({owner: data._id});
|
||||||
|
data.containers.forEach(function(container){
|
||||||
|
container.items = Items.find({container: container._id});
|
||||||
|
});
|
||||||
var newInstance = Object.create(protoCharacter);
|
var newInstance = Object.create(protoCharacter);
|
||||||
data = _.extend(newInstance, data);
|
data = _.extend(newInstance, data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.route('inventory', {
|
||||||
|
path: '/inventory/:_id',
|
||||||
|
notFoundTemplate: 'characterNotFound',
|
||||||
|
data: {
|
||||||
|
containers: function() {
|
||||||
|
var containers = Containers.find({owner: data._id});
|
||||||
|
containers.forEach(function(container){
|
||||||
|
container.items = Items.find({container: container._id});
|
||||||
|
});
|
||||||
|
return containers;
|
||||||
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.route('item', {
|
||||||
|
path: '/item/:_id',
|
||||||
|
notFoundTemplate: 'itemNotFound',
|
||||||
|
data: function() {
|
||||||
|
var data = Items.findOne({_id: this.params._id});
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -6,6 +6,9 @@
|
|||||||
{{name}}
|
{{name}}
|
||||||
</div>
|
</div>
|
||||||
<div id="role">
|
<div id="role">
|
||||||
{{alignment}} {{gender}} {{race}} {{#each class}} {{this}} {{/each}}
|
{{alignment}} {{gender}} {{race}}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
{{> healthBar}}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<div id="hitPointBox">
|
<div id="hitPointBox">
|
||||||
Hit Points
|
Hit Points
|
||||||
<div id="hitPoints">
|
<div id="hitPoints">
|
||||||
<input type="number" value={{attributeValue attributes.hitPoints}}>
|
<input type="number">
|
||||||
</div>
|
</div>
|
||||||
<div id="maxHitPoints">
|
<div id="maxHitPoints">
|
||||||
{{attributeValue attributes.maxHitPoints}}
|
{{attributeValue attributes.maxHitPoints}}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
Template.features.helpers = {
|
Template.features.helpers({
|
||||||
features: function(){
|
features: function(){
|
||||||
var features = Features.find({character: this._id});
|
var features = Features.find({character: this._id});
|
||||||
console.log('found: ', features);
|
console.log('found: ', features);
|
||||||
return features;
|
return features;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
Template.features.events = {
|
Template.features.events({
|
||||||
// Fires when any element is clicked
|
// Fires when any element is clicked
|
||||||
'change .enabled': function (event) {
|
'change .enabled': function (event) {
|
||||||
var enable = event.target.checked
|
var enable = event.target.checked
|
||||||
@@ -17,4 +17,4 @@ Template.features.events = {
|
|||||||
Template.parentData(1).pullEffects(this.effects);
|
Template.parentData(1).pullEffects(this.effects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
Reference in New Issue
Block a user