Remove settings and paths

stocked
Daniel Asher Resnick 3 years ago
parent d740e9a96a
commit e6d89e11a7
  1. 23
      src/public/js/stocked.js
  2. 24
      src/views/partials/stocked.erb

@ -1843,6 +1843,17 @@ function StockedSetting(name, charredSettingData) {
} }
StockedSetting.prototype.addLifepath = function() { StockedSetting.prototype.addLifepath = function() {
this.lifepaths.push(new StockedLifePath(this.newLifepathName, {})); 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) { function StockedLifePath(name, charredPathData) {
@ -1923,6 +1934,7 @@ StockedLifePathSkills.prototype.toString = function() {
}; };
function StockedLifePathTraits(charredTraitData) { function StockedLifePathTraits(charredTraitData) {
this.lpTraits = [];
if(charredTraitData) { if(charredTraitData) {
this.points = charredTraitData[0]; this.points = charredTraitData[0];
this.lpTraits = charredTraitData.slice(1); this.lpTraits = charredTraitData.slice(1);
@ -1952,7 +1964,9 @@ function StockedSkill(name, charredSkillData) {
Agility: false, Agility: false,
Speed: false, Speed: false,
}; };
if(charredSkillData.roots){
charredSkillData.roots.map(rootName => this.roots[rootName] = true); charredSkillData.roots.map(rootName => this.roots[rootName] = true);
}
this.stockSpecific = "TODO"; this.stockSpecific = "TODO";
} }
@ -1981,8 +1995,8 @@ function StockedCtrl($scope, burningData) {
$scope.general = { $scope.general = {
'Name': '', 'Name': '',
'Stride': 7, 'Stride': 7,
'CommonTraits': ['foo', 'baz'], 'CommonTraits': [],
'selectedTrait': 'bar' 'selectedTrait': ''
}; };
$scope.parseStock = function (stockData){ $scope.parseStock = function (stockData){
@ -2013,6 +2027,11 @@ function StockedCtrl($scope, burningData) {
$scope.addSetting = function (){ $scope.addSetting = function (){
this.settings.push(new StockedSetting(this.newSettingName, {})); this.settings.push(new StockedSetting(this.newSettingName, {}));
this.newSettingName = "";
}
$scope.removeSetting = function (index) {
this.settings.splice(index, 1);
} }
$scope.addSkill = function (){ $scope.addSkill = function (){

@ -87,6 +87,13 @@
</div> </div>
<div class='panel-collapse collapse in' id='collapse_settings'> <div class='panel-collapse collapse in' id='collapse_settings'>
<div class='panel-body'> <div class='panel-body'>
<span class="note-label">Note:</span>
<span class="note-content">
Settings will have " Setting" (or " Subsetting" for subsettings)
appended to the name in the generated charred model, which is how charred will display them.
</span>
<br />
<a ng-click='collapseBody(".collapse_all_settings", $event)' href=''> <a ng-click='collapseBody(".collapse_all_settings", $event)' href=''>
collapse/expand all settings collapse/expand all settings
</a> </a>
@ -97,6 +104,10 @@
<input class='form-control input-lg not-editing editable-name' <input class='form-control input-lg not-editing editable-name'
ng-model="setting.name" ng-click="$event.stopPropagation()" ng-model="setting.name" ng-click="$event.stopPropagation()"
ng-focus='editField($event, true)' ng-blur='editField($event, false)' /> ng-focus='editField($event, true)' ng-blur='editField($event, false)' />
<span class="panel-title" style="font-weight: bold;">
<input type="checkbox" ng-model="setting.isSubsetting" /> Subsetting?
</span>
<a href='' ng-click='removeSetting($index)'>[X]</a>
</div> </div>
<div class='panel-collapse collapse in collapse_all_settings' id='collapse_{{to_id(setting.name)}}'> <div class='panel-collapse collapse in collapse_all_settings' id='collapse_{{to_id(setting.name)}}'>
<div class='panel-body'> <div class='panel-body'>
@ -125,6 +136,7 @@
class='form-control input-lg not-editing editable-name' class='form-control input-lg not-editing editable-name'
ng-click="$event.stopPropagation()" ng-click="$event.stopPropagation()"
ng-focus='editField($event, true)' ng-blur='editField($event, false)' /> ng-focus='editField($event, true)' ng-blur='editField($event, false)' />
<a href='' ng-click='setting.removeLifepath($index)'>[X]</a>
</div> </div>
<div class="col-md-1"> <div class="col-md-1">
@ -143,21 +155,21 @@
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<input type="number" ng-model="path.stat.M" <label for="{{to_id(path.name)}}_M">M: </label>
<input type="number" ng-model="path.stat.M" id="{{to_id(path.name)}}_M"
class='not-editing editable-num' class='not-editing editable-num'
ng-click="$event.stopPropagation()" ng-click="$event.stopPropagation()"
ng-focus='editField($event, true)' ng-blur='editField($event, false)' /> ng-focus='editField($event, true)' ng-blur='editField($event, false)' />
<span>M</span> <label for="{{to_id(path.name)}}_P">P: </label>
<input type="number" ng-model="path.stat.P" <input type="number" ng-model="path.stat.P" id="{{to_id(path.name)}}_M"
class='not-editing editable-num' class='not-editing editable-num'
ng-click="$event.stopPropagation()" ng-click="$event.stopPropagation()"
ng-focus='editField($event, true)' ng-blur='editField($event, false)' /> ng-focus='editField($event, true)' ng-blur='editField($event, false)' />
<span>P</span> <label for="{{to_id(path.name)}}_PM">P/M: </label>
<input type="number" ng-model="path.stat.PM" <input type="number" ng-model="path.stat.PM" id="{{to_id(path.name)}}_M"
class='not-editing editable-num' class='not-editing editable-num'
ng-click="$event.stopPropagation()" ng-click="$event.stopPropagation()"
ng-focus='editField($event, true)' ng-blur='editField($event, false)' /> ng-focus='editField($event, true)' ng-blur='editField($event, false)' />
<span>P/M</span>
</div> </div>
<div class='h5 col-md-4 path-leads'> <div class='h5 col-md-4 path-leads'>

Loading…
Cancel
Save