From 050c71e872378962baed12b6cd5d9d4cd7f72ac2 Mon Sep 17 00:00:00 2001 From: Daniel Asher Resnick Date: Thu, 14 Apr 2022 14:57:53 -0500 Subject: [PATCH] 'wip' --- src/public/js/stocked.js | 38 ++++++++++++++++++++++++++++++++++ src/views/partials/stocked.erb | 31 +++++++++++++++++++++++++-- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/src/public/js/stocked.js b/src/public/js/stocked.js index e92fac4..d234ef8 100644 --- a/src/public/js/stocked.js +++ b/src/public/js/stocked.js @@ -1,3 +1,28 @@ +class TimeLogger { + constructor() { + this.logs = []; + this.unlabelled_id = 0; + this.start = this.previous = Date.now(); + this.log('start'); + } + log(label) { + var now = Date.now(); + var log = { + 'when': now, + 'label': label, + 'elapsed': now - this.previous, + 'total': now - this.start + }; + this.logs.push(log); + this.previous = now; + return log; + } +} + +const timelogger = new TimeLogger; + +console.log(timelogger.logs[0]); + var test_data = { "Chattel Setting": { "Born Chattel": { @@ -1594,6 +1619,8 @@ var test_data = { } }; +console.log(timelogger.log("post-data")); + function StockedSetting(name, settingData) { this.isSubsetting = false; if(result = name.match(/(.*) setting/i)) { @@ -1709,6 +1736,13 @@ function StockedCtrl($scope, burningData) { $scope.StockedUtil = StockedUtil; /* testing */ + $scope.general = { + 'Name': '', + 'Stride': 7, + 'CommonTraits': ['foo', 'baz'], + 'selectedTrait': 'bar' + }; + $scope.parseStock = function (stockData){ let settings = []; for (let name in stockData) { @@ -1720,6 +1754,10 @@ function StockedCtrl($scope, burningData) { $scope.settings = $scope.parseStock(test_data); /* end testing */ + $scope.addSetting = function (){ + this.settings.push(new StockedSetting(this.newSettingName, {})); + } + $scope.collapseBody = function(data_target, $event) { $(data_target).collapse("toggle"); if($event) { $event.stopPropagation(); } diff --git a/src/views/partials/stocked.erb b/src/views/partials/stocked.erb index ca39064..1ccecf5 100644 --- a/src/views/partials/stocked.erb +++ b/src/views/partials/stocked.erb @@ -55,7 +55,29 @@
- TODO: Name, common traits, stride, etc. + + + + + +
+ TODO: common traits +
+ {{general.CommonTraits}} + +
+
+ Add trait +
+
+ TODO: Add new trait +
+
+ TODO: other things in General section?
@@ -237,7 +259,12 @@
- + TODO: Add new setting + + + + TODO: Add new setting