From 059ebf7db2b3af5d44ac049b6b411a329595035f Mon Sep 17 00:00:00 2001 From: Thaum Date: Wed, 11 Mar 2015 12:56:01 +0000 Subject: [PATCH] Added carried checkboxes to containers --- .../client/views/character/features/features.css | 12 ++++++------ .../client/views/character/inventory/inventory.html | 5 ++++- .../client/views/character/inventory/inventory.js | 11 ++++++++++- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/rpg-docs/client/views/character/features/features.css b/rpg-docs/client/views/character/features/features.css index 6f97bac2..1b7bcce6 100644 --- a/rpg-docs/client/views/character/features/features.css +++ b/rpg-docs/client/views/character/features/features.css @@ -23,12 +23,12 @@ } /*To change the ink color for checked state:*/ -paper-checkbox.enabledCheckbox::shadow #ink[checked] { +.containerTop paper-checkbox::shadow #ink[checked] { color: #ffffff; } /*To change the checkbox checked color:*/ -paper-checkbox.enabledCheckbox::shadow #checkbox.checked { +.containerTop paper-checkbox::shadow #checkbox.checked { background-color: #ffffff; background-color: rgba(255,255,255,0.27); border-color: #ffffff; @@ -36,22 +36,22 @@ paper-checkbox.enabledCheckbox::shadow #checkbox.checked { } /*ensure the checkmark is shown when ticked*/ -paper-checkbox.enabledCheckbox::shadow #checkbox.checked #checkmark { +.containerTop paper-checkbox::shadow #checkbox.checked #checkmark { display: initial; } /*To change the ink color for unchecked state:*/ -paper-checkbox.enabledCheckbox::shadow #ink { +.containerTop paper-checkbox::shadow #ink { color: #ffffff; } /*To change the checkbox unchecked color:*/ -paper-checkbox.enabledCheckbox::shadow #checkbox { +.containerTop paper-checkbox::shadow #checkbox { border-color: #ffffff; border-color: rgba(255,255,255,0.54); } /*ensure checkmark isn't shown early*/ -paper-checkbox.enabledCheckbox::shadow #checkbox #checkmark { +.containerTop paper-checkbox::shadow #checkbox #checkmark { display: none; } diff --git a/rpg-docs/client/views/character/inventory/inventory.html b/rpg-docs/client/views/character/inventory/inventory.html index e0a37180..dc1fbdd5 100644 --- a/rpg-docs/client/views/character/inventory/inventory.html +++ b/rpg-docs/client/views/character/inventory/inventory.html @@ -40,7 +40,10 @@
{{name}}
{{valueString totalValue}}
-
{{round totalWeight}}lbs
+
{{round totalWeight}}lbs
+ + +
{{#each items ../_id _id}} diff --git a/rpg-docs/client/views/character/inventory/inventory.js b/rpg-docs/client/views/character/inventory/inventory.js index 4fe17a5d..87155ece 100644 --- a/rpg-docs/client/views/character/inventory/inventory.js +++ b/rpg-docs/client/views/character/inventory/inventory.js @@ -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}}); } });