From 040d5a514b40acd6e77d857267849a0843fd6d00 Mon Sep 17 00:00:00 2001 From: Thaum Date: Fri, 27 Feb 2015 06:14:34 +0000 Subject: [PATCH] Generalised some dialogs --- rpg-docs/.meteor/release | 2 +- rpg-docs/.meteor/versions | 7 +- rpg-docs/Model/Character/Actions.js | 4 +- rpg-docs/Model/Character/Attacks.js | 12 +- rpg-docs/Model/Character/Effects.js | 6 +- rpg-docs/Model/Character/Experience.js | 4 +- rpg-docs/Model/Character/Features.js | 4 +- rpg-docs/Model/Character/Levels/Classes.js | 2 +- rpg-docs/Model/Character/Notes.js | 4 +- rpg-docs/Model/Character/Proficiencies.js | 3 +- rpg-docs/Model/Character/SpellLists.js | 10 +- rpg-docs/Model/Character/Spells.js | 10 +- rpg-docs/Model/Inventory/Containers.js | 4 +- rpg-docs/Model/Inventory/Items.js | 6 +- rpg-docs/client/globalHelpers/mongol.js | 2 +- .../{ => effects}/effectEdit/effectEdit.css | 0 .../{ => effects}/effectEdit/effectEdit.html | 0 .../{ => effects}/effectEdit/effectEdit.js | 0 .../effectsEditList/effectsEditList.html | 15 ++ .../effectsEditList/effectsEditList.js | 17 ++ .../features/attackDialog/attackDialog.html | 56 +++---- .../features/attackDialog/attackDialog.js | 44 +---- .../features/featureDialog/featureDialog.html | 75 +++------ .../features/featureDialog/featureDialog.js | 45 +---- .../containerDialog/containerDialog.html | 50 ++---- .../containerDialog/containerDialog.js | 51 ++---- .../inventory/itemDialog/itemDialog.html | 136 +++++++--------- .../inventory/itemDialog/itemDialog.js | 124 ++++++-------- .../experienceDialog/experienceDialog.html | 40 ++--- .../experienceDialog/experienceDialog.js | 31 +--- .../journal/levelDialog/levelDialog.html | 34 +--- .../journal/levelDialog/levelDialog.js | 37 +---- .../journal/noteDialog/noteDialog.html | 36 ++-- .../journal/noteDialog/noteDialog.js | 37 +---- .../journal/raceDialog/raceDialog.html | 25 +-- .../journal/raceDialog/raceDialog.js | 32 ---- .../personaDetailsDialog.html | 26 ++- .../personaDetailsDialog.js | 26 --- .../persona/textDialog/textDialog.html | 21 +-- .../persona/textDialog/textDialog.js | 24 +-- .../spells/spellDialog/spellDialog.html | 154 ++++++++---------- .../spells/spellDialog/spellDialog.js | 81 +++------ .../spellListDialog/spellListDialog.html | 72 ++++---- .../spells/spellListDialog/spellListDialog.js | 43 +---- .../character/stats/healthCard/healthCard.js | 1 - rpg-docs/client/views/layout/imports.html | 1 + .../paperTemplates/baseDialog/baseDialog.html | 23 +++ .../paperTemplates/baseDialog/baseDialog.js | 24 +++ .../colorDropdown/colorDropdown.html | 15 +- .../colorDropdown/colorDropdown.js | 10 ++ 50 files changed, 532 insertions(+), 954 deletions(-) rename rpg-docs/client/views/character/{ => effects}/effectEdit/effectEdit.css (100%) rename rpg-docs/client/views/character/{ => effects}/effectEdit/effectEdit.html (100%) rename rpg-docs/client/views/character/{ => effects}/effectEdit/effectEdit.js (100%) create mode 100644 rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.html create mode 100644 rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.js create mode 100644 rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.html create mode 100644 rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js diff --git a/rpg-docs/.meteor/release b/rpg-docs/.meteor/release index 90f87be9..74a74cb1 100644 --- a/rpg-docs/.meteor/release +++ b/rpg-docs/.meteor/release @@ -1 +1 @@ -METEOR@1.0.3.1 +METEOR@1.0.3.2 diff --git a/rpg-docs/.meteor/versions b/rpg-docs/.meteor/versions index c3915dd4..f1a122af 100644 --- a/rpg-docs/.meteor/versions +++ b/rpg-docs/.meteor/versions @@ -3,8 +3,8 @@ accounts-password@1.0.6 accounts-ui@1.1.4 accounts-ui-unstyled@1.1.6 aldeed:autoform@4.2.2 -aldeed:collection2@2.3.1 -aldeed:simple-schema@1.1.0 +aldeed:collection2@2.3.2 +aldeed:simple-schema@1.3.0 application-configuration@1.0.4 autoupdate@1.1.5 base64@1.0.2 @@ -17,6 +17,7 @@ check@1.0.4 conielo:autoform-polymer-paper@0.1.1 cw4gn3r:jquery-event-drag@2.2.0 dburles:collection-helpers@1.0.2 +dburles:mongo-collection-instances@0.3.1 ddp@1.0.14 deps@1.0.6 differential:vulcanize@0.0.3 @@ -52,7 +53,7 @@ minimongo@1.0.6 mobile-status-bar@1.0.2 momentjs:moment@2.8.4 mongo@1.0.11 -msavin:mongol@0.1.1 +msavin:mongol@0.4.4 npm-bcrypt@0.7.7 observe-sequence@1.0.4 ordered-dict@1.0.2 diff --git a/rpg-docs/Model/Character/Actions.js b/rpg-docs/Model/Character/Actions.js index 744f01fe..69ab2d49 100644 --- a/rpg-docs/Model/Character/Actions.js +++ b/rpg-docs/Model/Character/Actions.js @@ -9,10 +9,10 @@ Schemas.Action = new SimpleSchema({ regEx: SimpleSchema.RegEx.Id }, name: { - type: String + type: String, trim: false }, description: { - type: String + type: String, trim: false }, type: { type: String, diff --git a/rpg-docs/Model/Character/Attacks.js b/rpg-docs/Model/Character/Attacks.js index 70813a36..4b88a60d 100644 --- a/rpg-docs/Model/Character/Attacks.js +++ b/rpg-docs/Model/Character/Attacks.js @@ -10,21 +10,25 @@ Schemas.Attack = new SimpleSchema({ }, name: { type: String, - defaultValue: "New Attack" + defaultValue: "New Attack", + trim: false }, range: { type: String, - optional: true + optional: true, + trim: false }, attackBonus: { type: String, optional: true, - defaultValue: "strengthMod + proficiencyBonus" + defaultValue: "strengthMod + proficiencyBonus", + trim: false }, damage: { type: String, optional: true, - defaultValue: "1d8 + {strengthMod}" + defaultValue: "1d8 + {strengthMod}", + trim: false }, damageType: { type: String, diff --git a/rpg-docs/Model/Character/Effects.js b/rpg-docs/Model/Character/Effects.js index 8aa172c4..00a08798 100644 --- a/rpg-docs/Model/Character/Effects.js +++ b/rpg-docs/Model/Character/Effects.js @@ -11,7 +11,8 @@ Schemas.Effect = new SimpleSchema({ }, name: { type: String, - optional: true //TODO make necessary if there is no owner + optional: true, //TODO make necessary if there is no owner + trim: false }, operation: { type: String, @@ -25,7 +26,8 @@ Schemas.Effect = new SimpleSchema({ }, calculation: { type: String, - optional: true + optional: true, + trim: false }, //indicates what the effect originated from type: { diff --git a/rpg-docs/Model/Character/Experience.js b/rpg-docs/Model/Character/Experience.js index f67b6399..3affb1e3 100644 --- a/rpg-docs/Model/Character/Experience.js +++ b/rpg-docs/Model/Character/Experience.js @@ -2,8 +2,8 @@ Experiences = new Meteor.Collection("experience"); Schemas.Experience = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id}, - name: {type: String, defaultValue: "New Experience"}, - description: {type: String, optional: true}, + name: {type: String, defaultValue: "New Experience", trim: false}, + description: {type: String, optional: true, trim: false}, value: {type: Number, defaultValue: 0}, dateAdded: { type: Date, diff --git a/rpg-docs/Model/Character/Features.js b/rpg-docs/Model/Character/Features.js index 73ef16e6..66832e5d 100644 --- a/rpg-docs/Model/Character/Features.js +++ b/rpg-docs/Model/Character/Features.js @@ -2,8 +2,8 @@ Features = new Meteor.Collection("features"); Schemas.Feature = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id}, - name: {type: String}, - description:{type: String, optional: true}, + name: {type: String, trim: false}, + description:{type: String, optional: true, trim: false}, uses: {type: String, optional: true, trim: false}, used: {type: Number, defaultValue: 0}, reset: {type: String, allowedValues: ["manual", "longRest", "shortRest"], defaultValue: "manual"}, diff --git a/rpg-docs/Model/Character/Levels/Classes.js b/rpg-docs/Model/Character/Levels/Classes.js index 3e31ca01..c06c9aae 100644 --- a/rpg-docs/Model/Character/Levels/Classes.js +++ b/rpg-docs/Model/Character/Levels/Classes.js @@ -2,7 +2,7 @@ Classes = new Meteor.Collection("classes"); Schemas.Class = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id}, - name: {type: String}, + name: {type: String, trim: false}, createdAt: { type: Date, autoValue: function() { diff --git a/rpg-docs/Model/Character/Notes.js b/rpg-docs/Model/Character/Notes.js index bc435089..370509f8 100644 --- a/rpg-docs/Model/Character/Notes.js +++ b/rpg-docs/Model/Character/Notes.js @@ -2,8 +2,8 @@ Notes = new Meteor.Collection("notes"); Schemas.Note = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id}, - name: {type: String}, - description: {type: String, optional: true}, + name: {type: String, trim: false}, + description: {type: String, optional: true, trim: false}, color: {type: String, allowedValues: _.pluck(colorOptions, "key"), defaultValue: "q"} }); diff --git a/rpg-docs/Model/Character/Proficiencies.js b/rpg-docs/Model/Character/Proficiencies.js index 5d6924f7..8947e1ef 100644 --- a/rpg-docs/Model/Character/Proficiencies.js +++ b/rpg-docs/Model/Character/Proficiencies.js @@ -6,7 +6,8 @@ Schemas.Proficiency = new SimpleSchema({ regEx: SimpleSchema.RegEx.Id }, name: { - type: String + type: String, + trim: false }, //indicates what type of thing proficiency originated from type: { diff --git a/rpg-docs/Model/Character/SpellLists.js b/rpg-docs/Model/Character/SpellLists.js index 3b75bad0..0badedea 100644 --- a/rpg-docs/Model/Character/SpellLists.js +++ b/rpg-docs/Model/Character/SpellLists.js @@ -2,11 +2,11 @@ SpellLists = new Meteor.Collection("spellLists"); Schemas.SpellLists = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id}, - name: {type: String}, - description: {type: String, optional: true}, - saveDC: {type: String, optional: true}, - attackBonus: {type: String, optional: true}, - maxPrepared: {type: String, optional: true}, + name: {type: String, trim: false}, + description: {type: String, optional: true, trim: false}, + saveDC: {type: String, optional: true, trim: false}, + attackBonus: {type: String, optional: true, trim: false}, + maxPrepared: {type: String, optional: true, trim: false}, color: {type: String, allowedValues: _.pluck(colorOptions, "key"), defaultValue: "q"}, "settings.showUnprepared": {type: Boolean, defaultValue: true}, }); diff --git a/rpg-docs/Model/Character/Spells.js b/rpg-docs/Model/Character/Spells.js index ec1173a0..6371e67c 100644 --- a/rpg-docs/Model/Character/Spells.js +++ b/rpg-docs/Model/Character/Spells.js @@ -4,11 +4,11 @@ Schemas.Spell = new SimpleSchema({ charId: {type: String, regEx: SimpleSchema.RegEx.Id}, listId: {type: String, regEx: SimpleSchema.RegEx.Id}, prepared: {type: String, defaultValue: "unprepared", allowedValues: ["prepared","unprepared","always"]}, - name: {type: String}, - description: {type: String, optional: true}, - castingTime: {type: String, optional: true, defaultValue: "action"}, - range: {type: String, optional: true}, - duration: {type: String, optional: true}, + name: {type: String, trim: false}, + description: {type: String, optional: true, trim: false}, + castingTime: {type: String, optional: true, defaultValue: "action", trim: false}, + range: {type: String, optional: true, trim: false}, + duration: {type: String, optional: true, trim: false}, "components.verbal": {type: Boolean, defaultValue: false}, "components.somatic": {type: Boolean, defaultValue: false}, "components.material": {type: String, optional: true}, diff --git a/rpg-docs/Model/Inventory/Containers.js b/rpg-docs/Model/Inventory/Containers.js index 7fff43ec..ac32d51d 100644 --- a/rpg-docs/Model/Inventory/Containers.js +++ b/rpg-docs/Model/Inventory/Containers.js @@ -2,12 +2,12 @@ Containers = new Meteor.Collection("containers"); Schemas.Container = new SimpleSchema({ - name: { type: String }, + name: { type: String, trim: false }, charId: { type: String, regEx: SimpleSchema.RegEx.Id}, isCarried: { type: Boolean }, weight: {type: Number, min: 0, defaultValue: 0, decimal: true}, value: {type: Number, min: 0, defaultValue: 0, decimal: true}, - description:{type: String, optional: true}, + description:{type: String, optional: true, trim: false}, color: {type: String, allowedValues: _.pluck(colorOptions, "key"), defaultValue: "q"} }); diff --git a/rpg-docs/Model/Inventory/Items.js b/rpg-docs/Model/Inventory/Items.js index 8302b0c8..bf8032d4 100644 --- a/rpg-docs/Model/Inventory/Items.js +++ b/rpg-docs/Model/Inventory/Items.js @@ -1,9 +1,9 @@ Items = new Meteor.Collection('items'); Schemas.Item = new SimpleSchema({ - name: {type: String, defaultValue: "New Item"}, - plural: {type: String, optional: true}, - description:{type: String, optional: true}, + name: {type: String, defaultValue: "New Item", trim: false}, + plural: {type: String, optional: true, trim: false}, + description:{type: String, optional: true, trim: false}, container: {type: String, regEx: SimpleSchema.RegEx.Id}, //id of container it is normally stowed in charId: {type: String, regEx: SimpleSchema.RegEx.Id}, //id of owner quantity: {type: Number, min: 0, defaultValue: 1}, diff --git a/rpg-docs/client/globalHelpers/mongol.js b/rpg-docs/client/globalHelpers/mongol.js index 8e46ef56..95ec5790 100644 --- a/rpg-docs/client/globalHelpers/mongol.js +++ b/rpg-docs/client/globalHelpers/mongol.js @@ -14,7 +14,7 @@ Session.set("Mongol", { "Spells", "SpellLists" ], - 'display': true, + 'display': false, 'opacity_normal': ".7", 'opacity_expand': ".9", 'disable_warning': 'false', diff --git a/rpg-docs/client/views/character/effectEdit/effectEdit.css b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.css similarity index 100% rename from rpg-docs/client/views/character/effectEdit/effectEdit.css rename to rpg-docs/client/views/character/effects/effectEdit/effectEdit.css diff --git a/rpg-docs/client/views/character/effectEdit/effectEdit.html b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.html similarity index 100% rename from rpg-docs/client/views/character/effectEdit/effectEdit.html rename to rpg-docs/client/views/character/effects/effectEdit/effectEdit.html diff --git a/rpg-docs/client/views/character/effectEdit/effectEdit.js b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.js similarity index 100% rename from rpg-docs/client/views/character/effectEdit/effectEdit.js rename to rpg-docs/client/views/character/effects/effectEdit/effectEdit.js diff --git a/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.html b/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.html new file mode 100644 index 00000000..f710e0f6 --- /dev/null +++ b/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.html @@ -0,0 +1,15 @@ + + \ No newline at end of file diff --git a/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.js b/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.js new file mode 100644 index 00000000..cbd8861c --- /dev/null +++ b/rpg-docs/client/views/character/effects/effectsEditList/effectsEditList.js @@ -0,0 +1,17 @@ +Template.effectsEditList.helpers({ + effects: function(){ + var cursor = Effects.find({sourceId: this.sourceId}); + return cursor; + } +}); + +Template.effectsEditList.events({ + "tap #addEffectButton": function(){ + Effects.insert({ + charId: this.charId, + sourceId: this.sourceId, + operation: "add", + type: this.type + }); + }, +}); \ No newline at end of file diff --git a/rpg-docs/client/views/character/features/attackDialog/attackDialog.html b/rpg-docs/client/views/character/features/attackDialog/attackDialog.html index 6eeb910a..dfe169bd 100644 --- a/rpg-docs/client/views/character/features/attackDialog/attackDialog.html +++ b/rpg-docs/client/views/character/features/attackDialog/attackDialog.html @@ -1,40 +1,26 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/features/attackDialog/attackDialog.js b/rpg-docs/client/views/character/features/attackDialog/attackDialog.js index 8ce378e9..0e6c5154 100644 --- a/rpg-docs/client/views/character/features/attackDialog/attackDialog.js +++ b/rpg-docs/client/views/character/features/attackDialog/attackDialog.js @@ -1,41 +1,14 @@ var damageTypes = ["bludgeoning", "piercing", "slashing", "acid", "cold", "fire", "force", "lightning", "necrotic", "poison", "psychic", "radiant", "thunder"]; -Template.attackDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; - } -} - Template.attackDialog.events({ - "tap #backButton": function(){ - GlobalUI.closeDetail() + "color-change": function(event, instance){ + Attacks.update(instance.data.attackId, {$set: {color: event.color}}); }, - "tap #deleteAttack": function(){ - Attacks.remove(this._id); + "tap #deleteButton": function(event, instance){ + Attacks.remove(instance.data.attackId); GlobalUI.closeDetail() }, - "tap #addEffectButton": function(){ - Effects.insert({ - charId: this.charId, - sourceId: this._id, - operation: "add", - type: "attack" - }); - }, "change #attackNameInput": function(event){ var value = event.currentTarget.value; Attacks.update(this._id, {$set: {name: value}}); @@ -58,14 +31,7 @@ Template.attackDialog.events({ var value = detail.item.getAttribute("name"); if(value == this.damageType) return; Attacks.update(this._id, {$set: {damageType: value}}); - }, - "core-select .colorDropdown": function(event){ - var detail = event.originalEvent.detail; - if(!detail.isSelected) return; - var value = detail.item.getAttribute("name"); - if(value == this.color) return; - Attacks.update(this._id, {$set: {color: value}}); - }, + } }); Template.attackDialog.helpers({ diff --git a/rpg-docs/client/views/character/features/featureDialog/featureDialog.html b/rpg-docs/client/views/character/features/featureDialog/featureDialog.html index 87497154..c6114872 100644 --- a/rpg-docs/client/views/character/features/featureDialog/featureDialog.html +++ b/rpg-docs/client/views/character/features/featureDialog/featureDialog.html @@ -1,56 +1,31 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/features/featureDialog/featureDialog.js b/rpg-docs/client/views/character/features/featureDialog/featureDialog.js index 49ec5654..6770f9d1 100644 --- a/rpg-docs/client/views/character/features/featureDialog/featureDialog.js +++ b/rpg-docs/client/views/character/features/featureDialog/featureDialog.js @@ -1,38 +1,11 @@ -Template.featureDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; - } -} - Template.featureDialog.events({ - "tap #backButton": function(){ - GlobalUI.closeDetail() + "color-change": function(event, instance){ + Features.update(instance.data.featureId, {$set: {color: event.color}}); }, - "tap #deleteFeature": function(){ - Features.remove(this._id); + "tap #deleteButton": function(event, instance){ + Features.remove(instance.data.featureId); GlobalUI.closeDetail() }, - "tap #addEffectButton": function(){ - Effects.insert({ - charId: Template.currentData().charId, - sourceId: this._id, - operation: "add", - type: "feature" - }); - }, "change #featureNameInput": function(event){ var name = Template.instance().find("#featureNameInput").value; Features.update(this._id, {$set: {name: name}}); @@ -54,12 +27,6 @@ Template.featureDialog.events({ var value = event.target.value; var featureId = this._id; Features.update(featureId, {$set: {uses: value}}); - }, - "core-select .colorDropdown": function(event){ - var detail = event.originalEvent.detail; - if(!detail.isSelected) return; - var value = detail.item.getAttribute("name"); - Features.update(this._id, {$set: {color: value}}); } }); @@ -67,10 +34,6 @@ Template.featureDialog.helpers({ feature: function(){ return Features.findOne(this.featureId); }, - effects: function(){ - var cursor = Effects.find({sourceId: this._id, type: "feature"}) - return cursor; - }, usesSet: function(){ return _.isString(this.uses); }, diff --git a/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html b/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html index a50afaa0..5b13c831 100644 --- a/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html +++ b/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.html @@ -1,36 +1,22 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.js b/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.js index 24c763b4..2c4647e5 100644 --- a/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.js +++ b/rpg-docs/client/views/character/inventory/containerDialog/containerDialog.js @@ -1,31 +1,17 @@ -Template.containerDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; +Template.containerDialog.helpers({ + container: function(){ + return Containers.findOne(this.containerId); } -} +}); Template.containerDialog.events({ - "tap #backButton": function(){ - GlobalUI.closeDetail(); + "color-change": function(event, instance){ + Containers.update(instance.data.containerId, {$set: {color: event.color}}); }, - "tap #deleteContainer": function(){ - Containers.remove(this._id); - GlobalUI.closeDetail(); + "tap #deleteButton": function(event, instance){ + Containers.remove(instance.data.containerId); + GlobalUI.closeDetail() }, - //TODO clean up String -> num here so they don't need casting by Schema.clean //TODO validate input (integer, non-negative, etc) for these inputs and give validation errors "change #containerNameInput, input #containerNameInput": function(event){ console.log("changed Nameinput") @@ -33,30 +19,15 @@ Template.containerDialog.events({ Containers.update(this._id, {$set: {name: name}}); }, "change #weightInput, input #weightInput": function(event){ - var weight = Template.instance().find("#weightInput").value; + var weight = +Template.instance().find("#weightInput").value; Containers.update(this._id, {$set: {weight: weight}}); }, "change #valueInput, input #valueInput": function(event){ - var value = Template.instance().find("#valueInput").value; + var value = +Template.instance().find("#valueInput").value; Containers.update(this._id, {$set: {value: value}}); }, "change #containerDescriptionInput": function(event){ var description = Template.instance().find("#containerDescriptionInput").value; Containers.update(this._id, {$set: {description: description}}); - }, - "core-select .colorDropdown": function(event){ - var detail = event.originalEvent.detail; - if(!detail.isSelected) return; - var value = detail.item.getAttribute("name"); - Containers.update(this._id, {$set: {color: value}}); } }); - -Template.containerDialog.helpers({ - container: function(){ - return Containers.findOne(this.containerId); - }, - colorClass: function(){ - return getColorClass(this.color) - } -}); \ No newline at end of file diff --git a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html index 26a70993..b27839ea 100644 --- a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html +++ b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.html @@ -1,84 +1,62 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js index b31804e6..34d5fbb1 100644 --- a/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js +++ b/rpg-docs/client/views/character/inventory/itemDialog/itemDialog.js @@ -1,39 +1,51 @@ -Template.itemDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; +var getContainers = function(charId){ + return Containers.find({charId: charId}, {sort: {name: 1, _id: 1}, fields: {name: 1}}).fetch(); +}; + +var equipmentSlots = [ + {name: "None", value: "none"}, + {name: "Held", value: "held"}, + {name: "Armor", value: "armor"}, + {name: "Head", value: "head"}, + {name: "Arms", value: "arms"}, + {name: "Hands", value: "hands"}, + {name: "Feet", value: "feet"} +]; + +Template.itemDialog.helpers({ + item: function(){ + return Items.findOne(this.itemId); + }, + containers: function(){ + return getContainers(this.charId); + }, + containerIndex: function(){ + var containers = getContainers(this.charId); + var containerIds = _.pluck(containers, "_id"); + return _.indexOf(containerIds, this.container); + }, + equipmentSlots: function(){ + return equipmentSlots; + }, + equipmentSlotIndex: function(){ + return _.indexOf(_.pluck(equipmentSlots, "value"), this.equipmentSlot); + }, + canEquip: function(){ + return this.equipmentSlot !== "none"; + }, + ne1: function(num){ + return num != 1; } -} +}); Template.itemDialog.events({ - "tap #backButton": function(){ - GlobalUI.closeDetail(); + "color-change": function(event, instance){ + Items.update(instance.data.itemId, {$set: {color: event.color}}); }, - "tap #deleteItem": function(){ - Items.remove(this._id); - GlobalUI.closeDetail(); + "tap #deleteButton": function(event, instance){ + Items.remove(instance.data.itemId); + GlobalUI.closeDetail() }, - "tap #addEffectButton": function(){ - Effects.insert({ - charId: Template.currentData().charId, - sourceId: this._id, - operation: "add", - type: "equipment" - }); - }, - //TODO clean up String -> num here so they don't need casting by Schema.clean //TODO validate input (integer, non-negative, etc) for these inputs and give validation errors "change #itemNameInput, input #itemNameInput": function(event){ console.log("changed Nameinput") @@ -45,15 +57,15 @@ Template.itemDialog.events({ Items.update(this._id, {$set: {plural: plural}}); }, "change #quantityInput, input #quantityInput": function(event){ - var quantity = Template.instance().find("#quantityInput").value; + var quantity = +Template.instance().find("#quantityInput").value; Items.update(this._id, {$set: {quantity: quantity}}); }, "change #weightInput, input #weightInput": function(event){ - var weight = Template.instance().find("#weightInput").value; + var weight = +Template.instance().find("#weightInput").value; Items.update(this._id, {$set: {weight: weight}}); }, "change #valueInput, input #valueInput": function(event){ - var value = Template.instance().find("#valueInput").value; + var value = +Template.instance().find("#valueInput").value; Items.update(this._id, {$set: {value: value}}); }, "change #itemDescriptionInput": function(event){ @@ -77,47 +89,3 @@ Template.itemDialog.events({ Items.update(Template.currentData().itemId, {$set: {equipmentSlot: value}}); } }); - -var getContainers = function(charId){ - return Containers.find({charId: charId}, {sort: {name: 1, _id: 1}, fields: {name: 1}}).fetch(); -}; - -var equipmentSlots = [ - {name: "None", value: "none"}, - {name: "Held", value: "held"}, - {name: "Armor", value: "armor"}, - {name: "Head", value: "head"}, - {name: "Arms", value: "arms"}, - {name: "Hands", value: "hands"}, - {name: "Feet", value: "feet"} -]; - -Template.itemDialog.helpers({ - item: function(){ - return Items.findOne(this.itemId); - }, - effects: function(){ - var cursor = Effects.find({charId: this.charId, type: "equipment", sourceId: this._id}) - return cursor; - }, - containers: function(){ - return getContainers(this.charId); - }, - containerIndex: function(){ - var containers = getContainers(this.charId); - var containerIds = _.pluck(containers, "_id"); - return _.indexOf(containerIds, this.container); - }, - equipmentSlots: function(){ - return equipmentSlots; - }, - equipmentSlotIndex: function(){ - return _.indexOf(_.pluck(equipmentSlots, "value"), this.equipmentSlot); - }, - canEquip: function(){ - return this.equipmentSlot !== "none"; - }, - ne1: function(num){ - return num != 1; - } -}); diff --git a/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.html b/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.html index 7f4ac9f9..453bbee4 100644 --- a/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.html +++ b/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.html @@ -1,32 +1,20 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.js b/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.js index 1d862535..1e52a691 100644 --- a/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.js +++ b/rpg-docs/client/views/character/journal/experienceDialog/experienceDialog.js @@ -1,38 +1,15 @@ -Template.experienceDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; - } -} - Template.experienceDialog.events({ - "tap #backButton": function(){ - GlobalUI.closeDetail(); + "tap #deleteButton": function(event, instance){ + Experiences.remove(instance.data.experienceId); + GlobalUI.closeDetail() }, - "tap #deleteExperience": function(){ - Experiences.remove(this._id); - GlobalUI.closeDetail(); - }, - //TODO clean up String -> num here so they don't need casting by Schema.clean //TODO validate input (integer, non-negative, etc) for these inputs and give validation errors "change #experienceNameInput, input #experienceNameInput": function(event){ var value = event.currentTarget.value Experiences.update(this._id, {$set: {name: value}}); }, "change #valueInput": function(event){ - var value = event.currentTarget.value + var value = +event.currentTarget.value Experiences.update(this._id, {$set: {value: value}}); }, "change #experienceDescriptionInput": function(event){ diff --git a/rpg-docs/client/views/character/journal/levelDialog/levelDialog.html b/rpg-docs/client/views/character/journal/levelDialog/levelDialog.html index b1468007..ddb6280f 100644 --- a/rpg-docs/client/views/character/journal/levelDialog/levelDialog.html +++ b/rpg-docs/client/views/character/journal/levelDialog/levelDialog.html @@ -1,32 +1,10 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/journal/levelDialog/levelDialog.js b/rpg-docs/client/views/character/journal/levelDialog/levelDialog.js index 8193c26f..c24fdc62 100644 --- a/rpg-docs/client/views/character/journal/levelDialog/levelDialog.js +++ b/rpg-docs/client/views/character/journal/levelDialog/levelDialog.js @@ -1,38 +1,8 @@ -Template.levelDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; - } -} - Template.levelDialog.events({ - "tap #backButton": function(){ + "tap #deleteButton": function(event, instance){ + Levels.remove(instance.data.levelId); GlobalUI.closeDetail() }, - "tap #deleteLevel": function(){ - Levels.remove(this._id); - GlobalUI.closeDetail() - }, - "tap #addEffectButton": function(){ - Effects.insert({ - charId: this.charId, - sourceId: this._id, - operation: "add", - type: "level" - }); - }, "change #levelValueInput": function(event){ var value = event.currentTarget.value; Levels.update(this._id, {$set: {value: value}}); @@ -42,8 +12,5 @@ Template.levelDialog.events({ Template.levelDialog.helpers({ level: function(){ return Levels.findOne(this.levelId); - }, - effects: function(){ - return Effects.find({sourceId: this._id, type: "level"}); } }); \ No newline at end of file diff --git a/rpg-docs/client/views/character/journal/noteDialog/noteDialog.html b/rpg-docs/client/views/character/journal/noteDialog/noteDialog.html index cf596e5d..158fb930 100644 --- a/rpg-docs/client/views/character/journal/noteDialog/noteDialog.html +++ b/rpg-docs/client/views/character/journal/noteDialog/noteDialog.html @@ -1,30 +1,16 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/journal/noteDialog/noteDialog.js b/rpg-docs/client/views/character/journal/noteDialog/noteDialog.js index 85a0184c..2bd9177f 100644 --- a/rpg-docs/client/views/character/journal/noteDialog/noteDialog.js +++ b/rpg-docs/client/views/character/journal/noteDialog/noteDialog.js @@ -1,32 +1,11 @@ -Template.noteDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; - } -} - Template.noteDialog.events({ - "tap #backButton": function(){ - GlobalUI.closeDetail(); + "color-change": function(event, instance){ + Notes.update(instance.data.noteId, {$set: {color: event.color}}); }, - "tap #deleteNote": function(){ - Notes.remove(this._id); - GlobalUI.closeDetail(); + "tap #deleteButton": function(event, instance){ + Notes.remove(instance.data.noteId); + GlobalUI.closeDetail() }, - //TODO clean up String -> num here so they don't need casting by Schema.clean - //TODO validate input (integer, non-negative, etc) for these inputs and give validation errors "change #noteNameInput, input #noteNameInput": function(event){ var value = event.currentTarget.value Notes.update(this._id, {$set: {name: value}}); @@ -34,12 +13,6 @@ Template.noteDialog.events({ "change #noteDescriptionInput": function(event){ var value = event.currentTarget.value Notes.update(this._id, {$set: {description: value}}); - }, - "core-select .colorDropdown": function(event){ - var detail = event.originalEvent.detail; - if(!detail.isSelected) return; - var value = detail.item.getAttribute("name"); - Notes.update(this._id, {$set: {color: value}}); } }); diff --git a/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html b/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html index 6d7368d8..4565800e 100644 --- a/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html +++ b/rpg-docs/client/views/character/journal/raceDialog/raceDialog.html @@ -1,23 +1,6 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/journal/raceDialog/raceDialog.js b/rpg-docs/client/views/character/journal/raceDialog/raceDialog.js index e6baa0ad..d53dc1e9 100644 --- a/rpg-docs/client/views/character/journal/raceDialog/raceDialog.js +++ b/rpg-docs/client/views/character/journal/raceDialog/raceDialog.js @@ -1,33 +1,4 @@ -Template.raceDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; - } -} - Template.raceDialog.events({ - "tap #backButton": function(){ - GlobalUI.closeDetail() - }, - "tap #addEffectButton": function(){ - Effects.insert({ - charId: this.charId, - operation: "add", - type: "racial" - }); - }, "change #raceInput": function(event){ var value = event.currentTarget.value; Characters.update(this.charId, {$set: {race: value}}); @@ -35,9 +6,6 @@ Template.raceDialog.events({ }); Template.raceDialog.helpers({ - effects: function(){ - return Effects.find({charId: this.charId, type: "racial"}); - }, race: function(){ var char = Characters.findOne(this.charId, {fields: {race: 1}}); return char && char.race; diff --git a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html index 8e7b3c72..e5951e44 100644 --- a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html +++ b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.html @@ -1,18 +1,12 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js index d9163631..05258d8c 100644 --- a/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js +++ b/rpg-docs/client/views/character/persona/peronaDetailsDialog/personaDetailsDialog.js @@ -1,30 +1,4 @@ -Template.personaDetailsDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; - } -}; - -Template.personaDetailsDialog.helpers({ - -}); - Template.personaDetailsDialog.events({ - "tap #backButton": function(){ - GlobalUI.closeDetail() - }, "change #nameInput": function(event){ var input = event.currentTarget.value; Characters.update( this.charId, {$set: {name: input}} ); diff --git a/rpg-docs/client/views/character/persona/textDialog/textDialog.html b/rpg-docs/client/views/character/persona/textDialog/textDialog.html index 7d280fd3..99613b8a 100644 --- a/rpg-docs/client/views/character/persona/textDialog/textDialog.html +++ b/rpg-docs/client/views/character/persona/textDialog/textDialog.html @@ -1,16 +1,9 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/persona/textDialog/textDialog.js b/rpg-docs/client/views/character/persona/textDialog/textDialog.js index 2fcca539..2e054e47 100644 --- a/rpg-docs/client/views/character/persona/textDialog/textDialog.js +++ b/rpg-docs/client/views/character/persona/textDialog/textDialog.js @@ -1,22 +1,3 @@ -Template.textDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; - } -}; - Template.textDialog.helpers({ value: function(){ var fieldSelector = {fields: {}}; @@ -32,8 +13,5 @@ Template.textDialog.events({ var setter = {$set: {}}; setter.$set[this.field] = input; Characters.update(this.charId, setter); - }, - "tap #backButton": function(){ - GlobalUI.closeDetail() - }, + } }); \ No newline at end of file diff --git a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html index 82a9335a..2b532073 100644 --- a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html +++ b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.html @@ -1,89 +1,75 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js index 32e38117..a57487fa 100644 --- a/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js +++ b/rpg-docs/client/views/character/spells/spellDialog/spellDialog.js @@ -11,35 +11,36 @@ var spellLevels = [ { name: "Level 9", level: 9 }, ]; -Template.spellDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; +Template.spellDialog.helpers({ + spell: function(){ + return Spells.findOne(this.spellId); + }, + spellLists: function(){ + return SpellLists.find({charId: this.charId}, {fields: {name: 1}}); + }, + magicSchools: function(){ + return magicSchools; + }, + spellLevels: function(){ + return spellLevels; + }, + preparedOptions: function(){ + return [ + {name: "Prepared", value: "prepared"}, + {name: "Unprepared", value: "unprepared"}, + {name: "Always Prepared", value: "always"} + ]; } -} +}); Template.spellDialog.events({ - "tap #backButton": function(){ - GlobalUI.closeDetail(); + "color-change": function(event, instance){ + Spells.update(instance.data.spellId, {$set: {color: event.color}}); }, - "tap #deleteSpell": function(){ - Spells.remove(this._id); - GlobalUI.closeDetail(); + "tap #deleteButton": function(event, instance){ + Spells.remove(instance.data.spellId); + GlobalUI.closeDetail() }, - //TODO clean up String -> num here so they don't need casting by Schema.clean - //TODO validate input (integer, non-negative, etc) for these inputs and give validation errors "change #spellNameInput, input #spellNameInput": function(event){ var value = event.currentTarget.value Spells.update(this._id, {$set: {name: value}}); @@ -92,13 +93,6 @@ Template.spellDialog.events({ if(value == this.school) return; Spells.update(this._id, {$set: {prepared: value}}); }, - "core-select .colorDropdown": function(event){ - var detail = event.originalEvent.detail; - if(!detail.isSelected) return; - var value = detail.item.getAttribute("name"); - if(value == this.color) return; - Spells.update(this._id, {$set: {color: value}}); - }, "change #verbalCheckbox": function(event){ var value = event.currentTarget.checked; Spells.update(this._id, {$set: {"components.verbal": value}}); @@ -116,28 +110,3 @@ Template.spellDialog.events({ Spells.update(this._id, {$set: {"ritual": value}}); }, }); - -Template.spellDialog.helpers({ - spell: function(){ - return Spells.findOne(this.spellId); - }, - colorClass: function(){ - return getColorClass(this.color) - }, - spellLists: function(){ - return SpellLists.find({charId: this.charId}, {fields: {name: 1}}); - }, - magicSchools: function(){ - return magicSchools; - }, - spellLevels: function(){ - return spellLevels; - }, - preparedOptions: function(){ - return [ - {name: "Prepared", value: "prepared"}, - {name: "Unprepared", value: "unprepared"}, - {name: "Always Prepared", value: "always"} - ]; - } -}); \ No newline at end of file diff --git a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html index fd4301b1..baabd527 100644 --- a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html +++ b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.html @@ -1,48 +1,34 @@ \ No newline at end of file diff --git a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.js b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.js index 3d5d9110..9c17d93a 100644 --- a/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.js +++ b/rpg-docs/client/views/character/spells/spellListDialog/spellListDialog.js @@ -1,29 +1,10 @@ -Template.spellListDialog.rendered = function(){ - var self = this; - //update all autogrows after they've been filled - var pata = this.$("paper-autogrow-textarea"); - pata.each(function(index, el){ - el.update($(el).children().get(0)); - }) - //update all input fields as well - var input = this.$("paper-input"); - input.each(function(index, el){ - el.valueChanged(); - }) - //after the dialog is built, open it - if (!this.alreadyRendered){ - Session.set("global.ui.detailShow", true); - this.alreadyRendered = true; - } -} - Template.spellListDialog.events({ - "tap #backButton": function(){ - GlobalUI.closeDetail(); + "color-change": function(event, instance){ + SpellLists.update(instance.data.spellListId, {$set: {color: event.color}}); }, - "tap #deleteSpellList": function(){ - SpellLists.remove(this._id); - GlobalUI.closeDetail(); + "tap #deleteButton": function(event, instance){ + SpellLists.remove(instance.data.spellListId); + GlobalUI.closeDetail() }, //TODO clean up String -> num here so they don't need casting by Schema.clean //TODO validate input (integer, non-negative, etc) for these inputs and give validation errors @@ -43,20 +24,14 @@ Template.spellListDialog.events({ var value = event.currentTarget.value SpellLists.update(this._id, {$set: {maxPrepared: value}}); }, - //TODO change #spellListDescription - "core-select .colorDropdown": function(event){ - var detail = event.originalEvent.detail; - if(!detail.isSelected) return; - var value = detail.item.getAttribute("name"); - SpellLists.update(this._id, {$set: {color: value}}); - } + "change #spellListDescriptionInput": function(event){ + var value = event.currentTarget.value + SpellLists.update(this._id, {$set: {description: value}}); + }, }); Template.spellListDialog.helpers({ spellList: function(){ return SpellLists.findOne(this.spellListId); - }, - colorClass: function(){ - return getColorClass(this.color) } }); \ No newline at end of file diff --git a/rpg-docs/client/views/character/stats/healthCard/healthCard.js b/rpg-docs/client/views/character/stats/healthCard/healthCard.js index e64b964a..005611ff 100644 --- a/rpg-docs/client/views/character/stats/healthCard/healthCard.js +++ b/rpg-docs/client/views/character/stats/healthCard/healthCard.js @@ -7,7 +7,6 @@ Template.healthCard.helpers({ return char && char.deathSave; }, failIcon: function(num){ - console.log("checking ", num, " against fail", this) if(num <= this.fail) return "radio-button-on"; else return "radio-button-off"; }, diff --git a/rpg-docs/client/views/layout/imports.html b/rpg-docs/client/views/layout/imports.html index 85bf3772..2f2c53ff 100644 --- a/rpg-docs/client/views/layout/imports.html +++ b/rpg-docs/client/views/layout/imports.html @@ -5,6 +5,7 @@ + diff --git a/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.html b/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.html new file mode 100644 index 00000000..20f587ef --- /dev/null +++ b/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.html @@ -0,0 +1,23 @@ + \ No newline at end of file diff --git a/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js b/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js new file mode 100644 index 00000000..2aa8b367 --- /dev/null +++ b/rpg-docs/client/views/paperTemplates/baseDialog/baseDialog.js @@ -0,0 +1,24 @@ +Template.baseDialog.rendered = function(){ + var self = this; + //update all autogrows after they've been filled + var pata = this.$("paper-autogrow-textarea"); + pata.each(function(index, el){ + el.update($(el).children().get(0)); + }) + //update all input fields as well + var input = this.$("paper-input"); + input.each(function(index, el){ + el.valueChanged(); + }) + //after the dialog is built, open it + if (!this.alreadyRendered){ + Session.set("global.ui.detailShow", true); + this.alreadyRendered = true; + } +} + +Template.baseDialog.events({ + "tap #backButton": function(){ + GlobalUI.closeDetail() + } +}); diff --git a/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.html b/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.html index 25b235c0..f0d52e17 100644 --- a/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.html +++ b/rpg-docs/client/views/paperTemplates/colorDropdown/colorDropdown.html @@ -1,4 +1,4 @@ -