From e6d89e11a7cdfe033edc91e7502e5ed9a0345b1f Mon Sep 17 00:00:00 2001 From: Daniel Asher Resnick Date: Tue, 7 Jun 2022 00:21:53 -0500 Subject: [PATCH] Remove settings and paths --- src/public/js/stocked.js | 25 ++++++++++++++++++++++--- src/views/partials/stocked.erb | 24 ++++++++++++++++++------ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/src/public/js/stocked.js b/src/public/js/stocked.js index f981a46..582397d 100644 --- a/src/public/js/stocked.js +++ b/src/public/js/stocked.js @@ -1843,6 +1843,17 @@ function StockedSetting(name, charredSettingData) { } StockedSetting.prototype.addLifepath = function() { this.lifepaths.push(new StockedLifePath(this.newLifepathName, {})); + this.newLifepathName = ""; +} +StockedSetting.prototype.removeLifepath = function(index) { + this.lifepaths.splice(index, 1); +} +StockedSetting.prototype.toCharred = function() { + let charred = {}; + // "setting" in name + // common traits + // stride + return charred; } function StockedLifePath(name, charredPathData) { @@ -1923,6 +1934,7 @@ StockedLifePathSkills.prototype.toString = function() { }; function StockedLifePathTraits(charredTraitData) { + this.lpTraits = []; if(charredTraitData) { this.points = charredTraitData[0]; this.lpTraits = charredTraitData.slice(1); @@ -1952,7 +1964,9 @@ function StockedSkill(name, charredSkillData) { Agility: false, Speed: false, }; - charredSkillData.roots.map(rootName => this.roots[rootName] = true); + if(charredSkillData.roots){ + charredSkillData.roots.map(rootName => this.roots[rootName] = true); + } this.stockSpecific = "TODO"; } @@ -1981,8 +1995,8 @@ function StockedCtrl($scope, burningData) { $scope.general = { 'Name': '', 'Stride': 7, - 'CommonTraits': ['foo', 'baz'], - 'selectedTrait': 'bar' + 'CommonTraits': [], + 'selectedTrait': '' }; $scope.parseStock = function (stockData){ @@ -2013,6 +2027,11 @@ function StockedCtrl($scope, burningData) { $scope.addSetting = function (){ this.settings.push(new StockedSetting(this.newSettingName, {})); + this.newSettingName = ""; + } + + $scope.removeSetting = function (index) { + this.settings.splice(index, 1); } $scope.addSkill = function (){ diff --git a/src/views/partials/stocked.erb b/src/views/partials/stocked.erb index 615595f..97d36cd 100644 --- a/src/views/partials/stocked.erb +++ b/src/views/partials/stocked.erb @@ -87,6 +87,13 @@
+ Note: + + Settings will have " Setting" (or " Subsetting" for subsettings) + appended to the name in the generated charred model, which is how charred will display them. + +
+ collapse/expand all settings @@ -97,6 +104,10 @@ + + Subsetting? + + [X]
@@ -125,6 +136,7 @@ class='form-control input-lg not-editing editable-name' ng-click="$event.stopPropagation()" ng-focus='editField($event, true)' ng-blur='editField($event, false)' /> + [X]
@@ -143,21 +155,21 @@
- M: + - M - P: + - P - P/M: + - P/M