From bce1b856004d59da96a2ce55963f37d28679a0b4 Mon Sep 17 00:00:00 2001 From: Jacob Date: Wed, 9 Aug 2017 11:38:30 +0100 Subject: [PATCH] Relocated the buff list to be inline in stats.html --- .../buffs/buffViewList/buffViewList.html | 30 ----------------- .../buffs/buffViewList/buffViewList.js | 32 ------------------- .../client/views/character/stats/stats.html | 29 ++++++++++++++++- .../client/views/character/stats/stats.js | 30 +++++++++++++++-- 4 files changed, 55 insertions(+), 66 deletions(-) delete mode 100644 rpg-docs/client/views/character/buffs/buffViewList/buffViewList.html delete mode 100644 rpg-docs/client/views/character/buffs/buffViewList/buffViewList.js diff --git a/rpg-docs/client/views/character/buffs/buffViewList/buffViewList.html b/rpg-docs/client/views/character/buffs/buffViewList/buffViewList.html deleted file mode 100644 index d8273057..00000000 --- a/rpg-docs/client/views/character/buffs/buffViewList/buffViewList.html +++ /dev/null @@ -1,30 +0,0 @@ - \ No newline at end of file diff --git a/rpg-docs/client/views/character/buffs/buffViewList/buffViewList.js b/rpg-docs/client/views/character/buffs/buffViewList/buffViewList.js deleted file mode 100644 index af07ae6c..00000000 --- a/rpg-docs/client/views/character/buffs/buffViewList/buffViewList.js +++ /dev/null @@ -1,32 +0,0 @@ -Template.buffViewList.helpers({ - conditions: function(){ - var selector = { - "charId": this._id, - "type": "inate", - }; - return Buffs.find(selector); - }, - buffs: function(){ - var selector = { - "charId": this._id, - "type": "custom", - }; - return Buffs.find(selector); - } -}); - -Template.buffViewList.events({ - "click #addCondition": function(event, template){ - pushDialogStack({ - template: "conditionLibraryDialog", - element: event.currentTarget, - callback: (result) => { - if (!result) { - return; - } - else Meteor.call("giveCondition", this._id, result) - }, - //returnElement: () => $(`[data-id='${itemId}']`).get(0), - }) - }, -}); diff --git a/rpg-docs/client/views/character/stats/stats.html b/rpg-docs/client/views/character/stats/stats.html index 74d0c8d6..4da78330 100644 --- a/rpg-docs/client/views/character/stats/stats.html +++ b/rpg-docs/client/views/character/stats/stats.html @@ -43,7 +43,34 @@ - {{> buffViewList}} +
+ +
+
Conditions
+ {{#if canEditCharacter _id}} + + {{/if}} +
+
+
+ {{#each condition in conditions}} + {{>buffListItem buff=condition}} + {{/each}} +
+ {{#if totalBuffs.count}} +
+
Buffs
+ View All +
+ {{/if}} +
+ {{#each buff in buffs}} + {{>buffListItem buff=buff}} + {{/each}} +
+
+
+
diff --git a/rpg-docs/client/views/character/stats/stats.js b/rpg-docs/client/views/character/stats/stats.js index d95e1213..8c02073c 100644 --- a/rpg-docs/client/views/character/stats/stats.js +++ b/rpg-docs/client/views/character/stats/stats.js @@ -1,7 +1,18 @@ Template.stats.helpers({ - buffs: function() { - return Buffs.find({charId: this._id}, {sort: {name: 1}}); - } + conditions: function(){ + var selector = { + "charId": this._id, + "type": "inate", + }; + return Buffs.find(selector); + }, + buffs: function(){ + var selector = { + "charId": this._id, + "type": "custom", + }; + return Buffs.find(selector); + }, }) Template.stats.events({ @@ -71,4 +82,17 @@ Template.stats.events({ element: event.currentTarget.parentElement.parentElement, }); }, + "click #addCondition": function(event, template){ + pushDialogStack({ + template: "conditionLibraryDialog", + element: event.currentTarget, + callback: (result) => { + if (!result) { + return; + } + else Meteor.call("giveCondition", this._id, result) + }, + //returnElement: () => $(`[data-id='${itemId}']`).get(0), + }) + }, });