diff --git a/rpg-docs/Model/Inventory/Containers.js b/rpg-docs/Model/Inventory/Containers.js index 2c92c8de..8ca640fa 100644 --- a/rpg-docs/Model/Inventory/Containers.js +++ b/rpg-docs/Model/Inventory/Containers.js @@ -23,7 +23,7 @@ Containers.helpers({ }, totalWeight: function(){ var weight = this.weight; - Items.find({container: this._id, equipped: false}, {fields: {weight: 1, value: 1}}).forEach(function(item){ + Items.find({container: this._id, equipped: false}, {fields: {quantity: 1, weight: 1}}).forEach(function(item){ weight += item.totalWeight(); }); return weight; diff --git a/rpg-docs/client/globalHelpers/GlobalUI.js b/rpg-docs/client/globalHelpers/GlobalUI.js index e25e4b48..8aeaf85e 100644 --- a/rpg-docs/client/globalHelpers/GlobalUI.js +++ b/rpg-docs/client/globalHelpers/GlobalUI.js @@ -37,7 +37,7 @@ this.GlobalUI = (function() { GlobalUI.showDetail = function(opts) { Session.set("global.ui.detailData", opts.data); Session.set("global.ui.detailTemplate", opts.template); - GlobalUI.detailHero = opts.hero; + Session.set("global.ui.detailHeroId", opts.heroId); Session.set("global.ui.detailShow", true); }; @@ -51,7 +51,7 @@ this.GlobalUI = (function() { GlobalUI.setDetail = function(opts) { Session.set("global.ui.detailData", opts.data); Session.set("global.ui.detailTemplate", opts.template); - GlobalUI.detailHero = opts.hero; + Session.set("global.ui.detailHeroId", opts.heroId); }; GlobalUI.closeDetail = function(){ @@ -108,21 +108,15 @@ Template.layout.events({ } else { Session.set("global.ui.detailData", null); Session.set("global.ui.detailTemplate", null); - //remove the hero attribute - var heroElem = GlobalUI.detailHero; - heroElem && heroElem.attr("hero", null); - heroElem && heroElem.find("[hero-id]").attr("hero", null); - GlobalUI.detailHero = null; + Session.set("global.ui.detailHeroId", null); } }, "core-animated-pages-transition-prepare": function(e) { var detailOpened = Session.get("global.ui.detailShow"); if(detailOpened) { - //add the hero attribute where needed - var heroElem = GlobalUI.detailHero; - heroElem && heroElem.attr("hero", ""); - heroElem && heroElem.find("[hero-id]").attr("hero", ""); + //set up the transition } else { + //undo hack $("#mainContentSection").removeClass("fake-selected"); } }, diff --git a/rpg-docs/client/globalHelpers/detailHero.js b/rpg-docs/client/globalHelpers/detailHero.js new file mode 100644 index 00000000..e3221a64 --- /dev/null +++ b/rpg-docs/client/globalHelpers/detailHero.js @@ -0,0 +1,5 @@ +Template.registerHelper("detailHero", function(){ + if ( Session.equals("global.ui.detailHeroId", this._id) ) { + return "hero"; + } +}); \ No newline at end of file diff --git a/rpg-docs/client/globalHelpers/round.js b/rpg-docs/client/globalHelpers/round.js new file mode 100644 index 00000000..b44ec56d --- /dev/null +++ b/rpg-docs/client/globalHelpers/round.js @@ -0,0 +1,6 @@ +Template.registerHelper("round", function(value, decimalPlaces){ + decimalPlaces = +decimalPlaces || 2; + var num = +value; + var tens = Math.pow(10, decimalPlaces) + return Math.round(num * tens) / tens; +}); \ No newline at end of file diff --git a/rpg-docs/client/views/GeneralCSS/typography.css b/rpg-docs/client/views/GeneralCSS/typography.css index ba8cec3e..5dbcc1f4 100644 --- a/rpg-docs/client/views/GeneralCSS/typography.css +++ b/rpg-docs/client/views/GeneralCSS/typography.css @@ -44,7 +44,7 @@ h2, .title { letter-spacing: 0.005em; } -.white-text h2{ +.white-text h2, .white-text .title, .white-text.title{ color: rgba(255,255,255,0.87); } diff --git a/rpg-docs/client/views/character/features/features.html b/rpg-docs/client/views/character/features/features.html index 4b59e53b..94352ccf 100644 --- a/rpg-docs/client/views/character/features/features.html +++ b/rpg-docs/client/views/character/features/features.html @@ -9,8 +9,8 @@
{{#each features}} - -
+ +

{{name}}

diff --git a/rpg-docs/client/views/character/features/features.js b/rpg-docs/client/views/character/features/features.js index ade7c37a..c15580a2 100644 --- a/rpg-docs/client/views/character/features/features.js +++ b/rpg-docs/client/views/character/features/features.js @@ -11,7 +11,7 @@ Template.features.events({ GlobalUI.setDetail({ template: "featureDialog", data: {featureId: featureId, charId: this._id}, - hero: $(event.currentTarget) + heroId: featureId }) }, "tap .featureCard": function(event){ @@ -20,7 +20,7 @@ Template.features.events({ GlobalUI.setDetail({ template: "featureDialog", data: {featureId: featureId, charId: charId}, - hero: $(event.currentTarget) + heroId: featureId }); } }); \ No newline at end of file diff --git a/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html b/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html index 0ad491a0..01a05c98 100644 --- a/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html +++ b/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html @@ -3,7 +3,7 @@ -
{{name}}
+
{{name}}
{{#if armor}} {{#with armor}} - {{name}} + {{name}} {{/with}} {{else}} none {{/if}} Equipment:
{{#each equipment}} - + {{name}} {{/each}}
{{#each containers}} - -

{{name}}

- {{#each items ../_id _id}} - + +
+
{{name}}
+
{{valueString totalValue}}
+
{{round totalWeight}}lbs
+
+
+ {{#each items ../_id _id}} + {{#if gt1 quantity}}{{quantity}}{{/if}} {{pluralName}} {{/each}} +
{{/each}}
diff --git a/rpg-docs/client/views/character/inventory/inventory.js b/rpg-docs/client/views/character/inventory/inventory.js index 39eac213..e2f45b74 100644 --- a/rpg-docs/client/views/character/inventory/inventory.js +++ b/rpg-docs/client/views/character/inventory/inventory.js @@ -39,7 +39,7 @@ Template.inventory.events({ GlobalUI.setDetail({ template: "itemDialog", data: {itemId: itemId, charId: charId}, - hero: $(event.currentTarget) + heroId: itemId }); }); }, @@ -47,8 +47,8 @@ Template.inventory.events({ var containerId = Containers.insert({name: "New Container", isCarried: true, charId: this._id}); GlobalUI.setDetail({ template: "containerDialog", - data: {containerId: this._id, charId: this.charId}, - hero: $(event.currentTarget) + data: {containerId: containerId, charId: this.charId}, + heroId: containerId }); }, "tap .inventoryItem": function(event){ @@ -57,14 +57,14 @@ Template.inventory.events({ GlobalUI.setDetail({ template: "itemDialog", data: {itemId: itemId, charId: charId}, - hero: $(event.currentTarget) + heroId: itemId }); }, - "tap .containerName": function(event){ + "tap .containerTop": function(event){ GlobalUI.setDetail({ template: "containerDialog", data: {containerId: this._id, charId: this.charId}, - hero: $(event.currentTarget).parent() + heroId: this._id }); } }); diff --git a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html index f5d94e1e..470d3a89 100644 --- a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html +++ b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html @@ -47,21 +47,21 @@ - - - + + + {{#each containers}} - {{name}} + {{name}} {{/each}} - - - + + + {{#each equipmentSlots}} - {{name}} + {{name}} {{/each}} diff --git a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js index 7e7bd048..01254e10 100644 --- a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js +++ b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js @@ -64,11 +64,17 @@ Template.itemDialog.events({ var equipped = Template.instance().find("#equippedInput").checked; Items.update(this._id, {$set: {equipped: equipped}}); }, - "tap .containerMenuItem": function(event){ - Items.update(Template.currentData().itemId, {$set: {container: this._id}}); + "core-select #containerDropDown": function(event){ + var detail = event.originalEvent.detail; + if(!detail.isSelected) return; + var containerId = detail.item.getAttribute("containerId"); + Items.update(Template.currentData().itemId, {$set: {container: containerId}}); }, - "tap .slotMenuItem": function(event){ - Items.update(Template.currentData().itemId, {$set: {equipmentSlot: this.value}}); + "core-select #slotDropDown": function(event){ + var detail = event.originalEvent.detail; + if(!detail.isSelected) return; + var value = detail.item.getAttribute("value"); + Items.update(Template.currentData().itemId, {$set: {equipmentSlot: value}}); } });