From 21894d77251ac6affe0e92a3ee55d0dfa7f21b60 Mon Sep 17 00:00:00 2001 From: chris2fr Date: Sat, 24 Oct 2020 14:40:34 +0200 Subject: [PATCH] Still Alpha Code, but WOrksish --- app/app.js | 17 ++++++++++++++--- index.html | 10 ++++++++-- scripts/storage.js | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/app.js b/app/app.js index 8dc0a48..62cea6e 100644 --- a/app/app.js +++ b/app/app.js @@ -58,7 +58,7 @@ var app = new Vue({ currentVersion: "", - availableVersions: [] + versions: [] }, created() @@ -66,6 +66,7 @@ var app = new Vue({ this.sections = models.newDefaultSections(); // this.versons = []; this.versions = storage.getLocalStorage("versions"); + this.currentVersion = ""; // console.log("this.sections=", this.sections); @@ -88,8 +89,9 @@ var app = new Vue({ { this.loadCountryCodes(); this.loadFromStorage(); + this.currentVersion = this.$root.sections.meta.version // Quick Fix - storage.setVersionedLocalStorage(this.$root.sections.meta.version, "sections", this.$root.sections); + storage.setVersionedLocalStorage(this.currentVersion, "sections", this.$root.sections); // console.log([this.$root.sections.meta.version,this.$root.sections]); //if (!this.availableVersions.hasKey(this.$root.sections.meta.version)) // this.availableVersions.push(this.$root.sections.meta.version); @@ -124,7 +126,16 @@ var app = new Vue({ this.activePage.fontAwesomeIconCss = component.fontAwesomeIcon; }, - + onVersionChange: function() { + // storage.setVersionedLocalStorage(this.currentVersion,"sections",this.$root.sections); + console.log(["version",this.currentVersion,this.$root.sections.meta.version]); + + this.$root.sections = storage.getVersionedLocalStorage(this.currentVersion,"sections"); + + console.log(["version",this.currentVersion,this.$root.sections.meta.version]); + + storage.setLocalStorage(this.$root.sections); // Perhaps optimisation to come + }, /** * Reset and clear the details of the active page. diff --git a/index.html b/index.html index ee0b33a..f3d8402 100644 --- a/index.html +++ b/index.html @@ -47,8 +47,14 @@