Remove settings and paths

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

@ -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 (){

@ -87,6 +87,13 @@
</div>
<div class='panel-collapse collapse in' id='collapse_settings'>
<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=''>
collapse/expand all settings
</a>
@ -97,6 +104,10 @@
<input class='form-control input-lg not-editing editable-name'
ng-model="setting.name" ng-click="$event.stopPropagation()"
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 class='panel-collapse collapse in collapse_all_settings' id='collapse_{{to_id(setting.name)}}'>
<div class='panel-body'>
@ -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)' />
<a href='' ng-click='setting.removeLifepath($index)'>[X]</a>
</div>
<div class="col-md-1">
@ -143,21 +155,21 @@
</div>
<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'
ng-click="$event.stopPropagation()"
ng-focus='editField($event, true)' ng-blur='editField($event, false)' />
<span>M</span>
<input type="number" ng-model="path.stat.P"
<label for="{{to_id(path.name)}}_P">P: </label>
<input type="number" ng-model="path.stat.P" id="{{to_id(path.name)}}_M"
class='not-editing editable-num'
ng-click="$event.stopPropagation()"
ng-focus='editField($event, true)' ng-blur='editField($event, false)' />
<span>P</span>
<input type="number" ng-model="path.stat.PM"
<label for="{{to_id(path.name)}}_PM">P/M: </label>
<input type="number" ng-model="path.stat.PM" id="{{to_id(path.name)}}_M"
class='not-editing editable-num'
ng-click="$event.stopPropagation()"
ng-focus='editField($event, true)' ng-blur='editField($event, false)' />
<span>P/M</span>
</div>
<div class='h5 col-md-4 path-leads'>

Loading…
Cancel
Save