From 9ff45dbcc24d65cb792bd7d67094ffb69b2f8389 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Wed, 17 Jun 2015 08:49:26 +0200 Subject: [PATCH] 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(){