diff --git a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.css b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.css index 4f501c01..9c577908 100644 --- a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.css +++ b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.css @@ -1,21 +1,13 @@ -body /deep/ #statGroupDropDown { - width: 120px; +html /deep/ .operationDropDown { + width: 152px; } -body /deep/ #statDropDown { - width: 120px; +html /deep/ .statDropDown { + width: 152px; } -body /deep/ #operationDropDown { - width: 100px; -} - -body /deep/ #damageMultiplierDropDown { - width: 120px; -} - -body /deep/ #proficiencyDropDown { - width: 120px; +html /deep/ .damageMultiplierDropDown { + width: 152px; } html /deep/ .effectEdit paper-input { @@ -24,6 +16,7 @@ html /deep/ .effectEdit paper-input { } html /deep/ .effectEdit { + height: 64px; display: flex; align-items: flex-end; } diff --git a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.html b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.html index 53de4244..277a667b 100644 --- a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.html +++ b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.html @@ -1,27 +1,23 @@ diff --git a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.js b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.js index b4ec4779..ec34b67b 100644 --- a/rpg-docs/client/views/character/effects/effectEdit/effectEdit.js +++ b/rpg-docs/client/views/character/effects/effectEdit/effectEdit.js @@ -93,24 +93,17 @@ var skillOperations = [ {name: "Conditional Benefit", operation: "conditional"} ]; -Template.effectEdit.created = function(){ - var statGroup = statsDict[this.data.stat] && statsDict[this.data.stat].group; - this.selectedStatGroup = new ReactiveVar(statGroup); -}; - Template.effectEdit.helpers({ - selectedStatGroup: function(){ - return Template.instance().selectedStatGroup.get(); - }, statGroups: function(){ return statGroupNames; }, stats: function(){ - var group = Template.instance().selectedStatGroup.get(); + var group = this; return statGroups[group]; }, operations: function(){ - var group = Template.instance().selectedStatGroup.get(); + var stat = statsDict[this.stat]; + var group = stat && stat.group; if (group === "Weakness/Resistance") return null; if (group === "Saving Throws" || group === "Skills"){ return skillOperations; @@ -120,7 +113,8 @@ Template.effectEdit.helpers({ }, effectValueTemplate: function(){ //resistance/vulnerability template - var group = Template.instance().selectedStatGroup.get(); + var stat = statsDict[this.stat]; + var group = stat && stat.group; if (group === "Weakness/Resistance") return "multiplierEffectValue"; var op = this.operation; @@ -144,25 +138,6 @@ Template.effectEdit.events({ Effects.softRemoveNode(this._id); GlobalUI.deletedToast(this._id, "Effects", "Effect"); }, - "core-select .statGroupDropDown": function(event, instance){ - var detail = event.originalEvent.detail; - if (!detail.isSelected) return; - var groupName = detail.item.getAttribute("name"); - var oldName = Template.instance().selectedStatGroup.get(); - if (oldName != groupName){ - instance.selectedStatGroup.set(groupName); - if (groupName === "Weakness/Resistance"){ - Effects.update(this._id, {$set: { - value: 0.5, - calculation: "", - operation: "mul"}, $unset: {stat: ""}}); - } else { - Effects.update(this._id, - {$set: {operation: "add"}, - $unset: {stat: "", value: "", calculation: ""}}); - } - } - }, "core-select .statDropDown": function(event){ var detail = event.originalEvent.detail; if (!detail.isSelected) return; diff --git a/rpg-docs/client/views/character/effects/effectView/effectView.js b/rpg-docs/client/views/character/effects/effectView/effectView.js index 80f497fd..f8c98a19 100644 --- a/rpg-docs/client/views/character/effects/effectView/effectView.js +++ b/rpg-docs/client/views/character/effects/effectView/effectView.js @@ -156,7 +156,7 @@ Template.effectView.helpers({ if (this.operation === "conditional"){ return this.calculation || this.value; } - if (stats[this.stat].group === "Weakness/Resistance"){ + if (stats[this.stat] && stats[this.stat].group === "Weakness/Resistance"){ if (this.value === 0.5) return "Resistance"; if (this.value === 2) return "Vulnerability"; if (this.value === 0) return "Immunity";