From 9ff45dbcc24d65cb792bd7d67094ffb69b2f8389 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 17 Jun 2015 08:49:26 +0200 Subject: [PATCH 1/4] backgrounds now have proficiencies --- .../backgroundDialog/backgroundDialog.html | 9 ++++++++ .../backgroundDialog/backgroundDialog.js | 8 +++++++ .../client/views/character/persona/persona.js | 22 ++++++++++--------- .../proficiencyView/proficiencyView.html | 10 ++++++--- .../proficiencyViewList.html | 2 +- .../stats/skillDialog/skillDialog.js | 10 ++++++++- 6 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html create mode 100644 rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.js diff --git a/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html b/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html new file mode 100644 index 00000000..4d31f38e --- /dev/null +++ b/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.html @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.js b/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.js new file mode 100644 index 00000000..2ec4e486 --- /dev/null +++ b/rpg-docs/client/views/character/persona/backgroundDialog/backgroundDialog.js @@ -0,0 +1,8 @@ +Template.backgroundDialog.helpers({ + value: function(){ + var fieldSelector = {fields: {}}; + fieldSelector.fields[this.field] = 1; + var char = Characters.findOne(this.charId, fieldSelector); + return char[this.field]; + } +}); diff --git a/rpg-docs/client/views/character/persona/persona.js b/rpg-docs/client/views/character/persona/persona.js index f3df7e3f..46063f25 100644 --- a/rpg-docs/client/views/character/persona/persona.js +++ b/rpg-docs/client/views/character/persona/persona.js @@ -40,11 +40,20 @@ Template.persona.helpers({ Template.persona.events({ "tap .characterField": function(event){ - if (this.field !== "details"){ + if (this.field === "details"){ + this.charId = Template.parentData()._id; + GlobalUI.setDetail({ + template: "personaDetailsDialog", + data: this, + heroId: this._id + this.field, + }); + } else { + var template = "textDialog"; + if (this.field === "backstory") template = "backgroundDialog"; var charId = Template.parentData()._id; GlobalUI.setDetail({ - template: "textDialog", - data: { + template: template, + data: { charId: charId, field: this.field, title: this.title, @@ -52,13 +61,6 @@ Template.persona.events({ }, heroId: this._id + this.field, }); - } else { - this.charId = Template.parentData()._id; - GlobalUI.setDetail({ - template: "personaDetailsDialog", - data: this, - heroId: this._id + this.field, - }); } } }); diff --git a/rpg-docs/client/views/character/proficiencies/proficiencyView/proficiencyView.html b/rpg-docs/client/views/character/proficiencies/proficiencyView/proficiencyView.html index d9a27836..5d79e37f 100644 --- a/rpg-docs/client/views/character/proficiencies/proficiencyView/proficiencyView.html +++ b/rpg-docs/client/views/character/proficiencies/proficiencyView/proficiencyView.html @@ -1,6 +1,10 @@ + + diff --git a/rpg-docs/client/views/character/proficiencies/proficiencyViewList/proficiencyViewList.html b/rpg-docs/client/views/character/proficiencies/proficiencyViewList/proficiencyViewList.html index 1a54310c..b4a08c23 100644 --- a/rpg-docs/client/views/character/proficiencies/proficiencyViewList/proficiencyViewList.html +++ b/rpg-docs/client/views/character/proficiencies/proficiencyViewList/proficiencyViewList.html @@ -2,7 +2,7 @@ {{#if proficiencies.count}}
-

Proficiencies

+

Proficiencies

{{#each proficiencies}} {{> proficiencyView}} {{/each}} diff --git a/rpg-docs/client/views/character/stats/skillDialog/skillDialog.js b/rpg-docs/client/views/character/stats/skillDialog/skillDialog.js index 8976b1aa..c2cbf6fc 100644 --- a/rpg-docs/client/views/character/stats/skillDialog/skillDialog.js +++ b/rpg-docs/client/views/character/stats/skillDialog/skillDialog.js @@ -212,7 +212,15 @@ Template.skillDialogView.helpers({ return Characters.findOne(this.charId, {fields:{_id: 1}}); }, sourceName: function(){ - if (this.parent.collection === "Characters") return "inate"; + if (this.parent.collection === "Characters"){ + if (this.parent.group === "racial"){ + return Characters.findOne(this.charId, {fields:{race: 1}}).race || "Race"; + } + if (this.parent.group === "background"){ + return "Background"; + } + return "Innate"; + } return this.getParent().name; }, operationName: function(){ From 314ce8541012cf4022383212ba88c8d21bfb07ad Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 17 Jun 2015 09:05:23 +0200 Subject: [PATCH 2/4] Attacks can now be added to spells --- rpg-docs/client/globalHelpers/openParentDialog.js | 5 +++++ .../views/character/spells/spellDialog/spellDialog.html | 2 ++ 2 files changed, 7 insertions(+) diff --git a/rpg-docs/client/globalHelpers/openParentDialog.js b/rpg-docs/client/globalHelpers/openParentDialog.js index 0d09dec3..7f1528a2 100644 --- a/rpg-docs/client/globalHelpers/openParentDialog.js +++ b/rpg-docs/client/globalHelpers/openParentDialog.js @@ -20,6 +20,11 @@ openParentDialog = function(parent, charId, heroId) { template: "itemDialog", data: {itemId: parent.id}, }; + } else if (parent.collection === "Spells") { + detail = { + template: "spellDialog", + data: {spellId: parent.id}, + }; } detail.heroId = heroId; detail.charId = charId; diff --git a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html index 155184db..68552057 100644 --- a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html +++ b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html @@ -27,6 +27,7 @@
{{evaluateString charId description}}
+ {{> attacksViewList charId=charId parentId=_id}} \ No newline at end of file From 248ab9bb6b7734001e0da9fd6b7a606d5aba8a26 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 17 Jun 2015 14:15:49 +0200 Subject: [PATCH 3/4] Added moving item dialog, that can't actually be triggered --- .../views/character/inventory/inventory.js | 14 +++++ .../moveItemDialog/moveItemDialog.css | 7 +++ .../moveItemDialog/moveItemDialog.html | 49 ++++++++++++++++ .../moveItemDialog/moveItemDialog.js | 56 +++++++++++++++++++ .../character/stats/healthCard/healthCard.css | 2 +- .../stats/healthCard/healthCard.html | 8 +-- rpg-docs/client/views/layout/imports.html | 3 +- .../paper-diff-slider.css} | 0 .../paper-diff-slider.html} | 24 ++++---- 9 files changed, 145 insertions(+), 18 deletions(-) create mode 100644 rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.css create mode 100644 rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.html create mode 100644 rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.js rename rpg-docs/public/custom_components/{paper-slider-diff/paper-slider.css => paper-diff-slider/paper-diff-slider.css} (100%) rename rpg-docs/public/custom_components/{paper-slider-diff/paper-slider.html => paper-diff-slider/paper-diff-slider.html} (92%) diff --git a/rpg-docs/client/views/character/inventory/inventory.js b/rpg-docs/client/views/character/inventory/inventory.js index 72b1fb19..58e70ea2 100644 --- a/rpg-docs/client/views/character/inventory/inventory.js +++ b/rpg-docs/client/views/character/inventory/inventory.js @@ -174,6 +174,20 @@ Template.inventory.events({ heroId: itemId, }); }, + "hold .inventoryItem": function(event, instance) { + var itemId = this._id; + var charId = Template.parentData()._id; + var containerId = this.parent.id; + GlobalUI.showDialog({ + template: "moveItemDialog", + data: { + charId: charId, + itemId: itemId, + containerId: containerId, + }, + heading: "Move " + this.pluralName(), + }); + }, "tap .incrementButtons": function(event) { event.stopPropagation(); }, diff --git a/rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.css b/rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.css new file mode 100644 index 00000000..5762ebbf --- /dev/null +++ b/rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.css @@ -0,0 +1,7 @@ +html /deep/ .moveItemDialog paper-tabs::shadow #selectionBar { + background-color: #D50000; +} + +html /deep/ .moveItemDialog paper-tab::shadow #ink { + color: #D50000; +} diff --git a/rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.html b/rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.html new file mode 100644 index 00000000..d11cfa41 --- /dev/null +++ b/rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.html @@ -0,0 +1,49 @@ + diff --git a/rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.js b/rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.js new file mode 100644 index 00000000..cf69a756 --- /dev/null +++ b/rpg-docs/client/views/character/inventory/moveItemDialog/moveItemDialog.js @@ -0,0 +1,56 @@ +Template.moveItemDialog.onCreated(function() { + Session.setDefault("moveItemDialogTab", "containers"); +}); + +Template.moveItemDialog.helpers({ + selectedTab: function() { + return Session.get("moveItemDialogTab"); + }, + characters: function() { + var userId = Meteor.userId(); + return Characters.find( + { + $or: [ + {readers: userId}, + {writers: userId}, + {owner: userId}, + ], + _id: {$ne: this.charId}, + }, + {fields: {name: 1}} + ); + }, + containers: function(){ + return Containers.find( + { + charId: this.charId, + _id: {$ne: this.containerId}, + }, + { + fields: {color: 1, name: 1}, + sort: {color: 1, name: 1}, + } + ); + }, +}); + +Template.moveItemDialog.events({ + "tap paper-tab": function(event) { + Session.set("moveItemDialogTab", event.currentTarget.getAttribute("name")); + }, + "tap #moveButton": function(event, instance) { + var tab = Session.get("moveItemDialogTab"); + if (tab === "containers"){ + var containerId = instance.find("#containerMenu").selected; + if (!containerId) throw "no menu selection"; + Meteor.call("moveItemToContainer", this.itemId, containerId); + } else if (tab === "characters"){ + var characterId = instance.find("#characterMenu").selected; + if (!characterId) throw "no menu selection"; + Meteor.call("moveItemToCharacter", this.itemId, characterId); + } else { + throw "Move item dialog tab is not set to containers or character," + + " it is set to " + tab; + } + }, +}); diff --git a/rpg-docs/client/views/character/stats/healthCard/healthCard.css b/rpg-docs/client/views/character/stats/healthCard/healthCard.css index a170d09e..98280aaf 100644 --- a/rpg-docs/client/views/character/stats/healthCard/healthCard.css +++ b/rpg-docs/client/views/character/stats/healthCard/healthCard.css @@ -1,4 +1,4 @@ -.healthCard paper-slider{ +.healthCard paper-diff-slider{ width: 100%; margin-right: 8px; } diff --git a/rpg-docs/client/views/character/stats/healthCard/healthCard.html b/rpg-docs/client/views/character/stats/healthCard/healthCard.html index 20c3a788..56f035e9 100644 --- a/rpg-docs/client/views/character/stats/healthCard/healthCard.html +++ b/rpg-docs/client/views/character/stats/healthCard/healthCard.html @@ -10,24 +10,24 @@
- + >
{{#each tempHitPoints}}
{{name}}
- + > {{#unless left}}{{#unless deleteOnZero}} {{/unless}}{{/unless}} diff --git a/rpg-docs/client/views/layout/imports.html b/rpg-docs/client/views/layout/imports.html index 911456ec..bedc1ce6 100644 --- a/rpg-docs/client/views/layout/imports.html +++ b/rpg-docs/client/views/layout/imports.html @@ -33,11 +33,12 @@ + - + diff --git a/rpg-docs/public/custom_components/paper-slider-diff/paper-slider.css b/rpg-docs/public/custom_components/paper-diff-slider/paper-diff-slider.css similarity index 100% rename from rpg-docs/public/custom_components/paper-slider-diff/paper-slider.css rename to rpg-docs/public/custom_components/paper-diff-slider/paper-diff-slider.css diff --git a/rpg-docs/public/custom_components/paper-slider-diff/paper-slider.html b/rpg-docs/public/custom_components/paper-diff-slider/paper-diff-slider.html similarity index 92% rename from rpg-docs/public/custom_components/paper-slider-diff/paper-slider.html rename to rpg-docs/public/custom_components/paper-diff-slider/paper-diff-slider.html index b991e190..0a2e283b 100644 --- a/rpg-docs/public/custom_components/paper-slider-diff/paper-slider.html +++ b/rpg-docs/public/custom_components/paper-diff-slider/paper-diff-slider.html @@ -8,55 +8,55 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN --> @@ -65,10 +65,10 @@ To change the slider secondary progress bar color: - +