Added carried checkboxes to containers

This commit is contained in:
Thaum
2015-03-11 12:56:01 +00:00
parent 2b9cbcf717
commit 059ebf7db2
3 changed files with 20 additions and 8 deletions

View File

@@ -40,7 +40,10 @@
<div class="containerTop {{colorClass}}" hero-id="toolbar" layout horizontal center {{detailHero}}>
<div class="containerName subhead" hero-id="title" flex {{detailHero}}>{{name}}</div>
<div class="caption" style="margin-right: 8px">{{valueString totalValue}}</div>
<div class="caption">{{round totalWeight}}lbs</div>
<div class="caption" style="margin-right: 8px">{{round totalWeight}}lbs</div>
<core-tooltip label="Container carried" position="left">
<paper-checkbox class="carriedCheckbox" checked={{isCarried}}></paper-checkbox>
</core-tooltip>
</div>
<div flex class="containerMain">
{{#each items ../_id _id}}

View File

@@ -30,7 +30,7 @@ Template.inventory.helpers({
Containers.find({charId: this._id, isCarried: true}).forEach(function(container){
weight += container.totalWeight();
});
Items.find({charId: this._id, equipped: false}, {fields: {weight : 1, quantity: 1}}).forEach(function(item){
Items.find({charId: this._id, equipped: true}, {fields: {weight : 1, quantity: 1}}).forEach(function(item){
weight += item.totalWeight();
});
return weight;
@@ -94,6 +94,15 @@ Template.inventory.events({
data: {containerId: this._id, charId: this.charId},
heroId: this._id
});
},
"tap .carriedCheckbox": function(event){
event.stopPropagation();
},
"change .carriedCheckbox": function(event){
var carried;
if(this.isCarried) carried = false;
else carried = true;
Containers.update(this._id, {$set: {isCarried: carried}});
}
});