Added item increment buttons

This commit is contained in:
Stefan Zermatten
2015-05-18 13:17:40 +02:00
parent ae416458b5
commit 679292373c
5 changed files with 59 additions and 10 deletions

View File

@@ -145,6 +145,17 @@ Template.inventory.events({
heroId: itemId,
});
},
"tap .incrementButtons": function(event) {
event.stopPropagation();
},
"tap .addItemQuantity": function(event) {
var itemId = this._id;
Items.update(itemId, {$set: {quantity: this.quantity + 1}});
},
"tap .subItemQuantity": function(event) {
var itemId = this._id;
Items.update(itemId, {$set: {quantity: this.quantity - 1}});
},
"tap .itemContainer .top": function(event){
GlobalUI.setDetail({
template: "containerDialog",
@@ -167,6 +178,9 @@ Template.inventoryItem.helpers({
ne1: function(num){
return num !== 1;
},
lt1: function(num) {
return num < 1;
},
hidden: function(){
return Session.equals("inventory.dragItemId", this._id) ? "hidden" : null;
},