Still Alpha Code, but WOrksish
This commit is contained in:
parent
78158e7e67
commit
21894d7725
15
app/app.js
15
app/app.js
|
|
@ -58,7 +58,7 @@ var app = new Vue({
|
||||||
|
|
||||||
currentVersion: "",
|
currentVersion: "",
|
||||||
|
|
||||||
availableVersions: []
|
versions: []
|
||||||
},
|
},
|
||||||
|
|
||||||
created()
|
created()
|
||||||
|
|
@ -66,6 +66,7 @@ var app = new Vue({
|
||||||
this.sections = models.newDefaultSections();
|
this.sections = models.newDefaultSections();
|
||||||
// this.versons = [];
|
// this.versons = [];
|
||||||
this.versions = storage.getLocalStorage("versions");
|
this.versions = storage.getLocalStorage("versions");
|
||||||
|
this.currentVersion = "";
|
||||||
|
|
||||||
// console.log("this.sections=", this.sections);
|
// console.log("this.sections=", this.sections);
|
||||||
|
|
||||||
|
|
@ -88,8 +89,9 @@ var app = new Vue({
|
||||||
{
|
{
|
||||||
this.loadCountryCodes();
|
this.loadCountryCodes();
|
||||||
this.loadFromStorage();
|
this.loadFromStorage();
|
||||||
|
this.currentVersion = this.$root.sections.meta.version
|
||||||
// Quick Fix
|
// 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]);
|
// console.log([this.$root.sections.meta.version,this.$root.sections]);
|
||||||
//if (!this.availableVersions.hasKey(this.$root.sections.meta.version))
|
//if (!this.availableVersions.hasKey(this.$root.sections.meta.version))
|
||||||
// this.availableVersions.push(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;
|
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.
|
* Reset and clear the details of the active page.
|
||||||
|
|
|
||||||
10
index.html
10
index.html
|
|
@ -47,8 +47,14 @@
|
||||||
<nav class="w3-sidebar w3-collapse w3-white w3-animate-left" style="z-index:3;width:300px;" id="mySidebar">
|
<nav class="w3-sidebar w3-collapse w3-white w3-animate-left" style="z-index:3;width:300px;" id="mySidebar">
|
||||||
<div class="w3-bar-block">
|
<div class="w3-bar-block">
|
||||||
<a href="#/" class="w3-bar-item w3-button w3-padding w3-blue"><i class="fas fa-home"></i> Home</a>
|
<a href="#/" class="w3-bar-item w3-button w3-padding w3-blue"><i class="fas fa-home"></i> Home</a>
|
||||||
<a v-bind:href="this.sections.meta.canonical" v-if="this.sections.meta.canonical != ''" target="_new" class="w3-bar-item w3-button w3-padding w3-blue">{{ this.sections.meta.version }}</a>
|
<form>
|
||||||
<span v-else class="w3-bar-item w3-button w3-padding w3-blue">{{ this.sections.meta.version }}</span><span v-if="this.sections.meta.lastModified != ''" class="w3-bar-item w3-button w3-padding w3-blue">({{ this.sections.meta.lastModified}})</span>
|
<select name="currentVersion" v-model="currentVersion" @change="onVersionChange()">
|
||||||
|
<option v-for="(version, v_index) in this.$root.versions">
|
||||||
|
{{ version }}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
|
<a v-bind:href="this.sections.meta.canonical" v-if="this.sections.meta.canonical != ''" target="_new" class="w3-bar-item w3-button w3-padding "><i class="fas fa-link"></i> link ({{ this.sections.meta.lastModified}})</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="w3-container w3-margin-top">
|
<div class="w3-container w3-margin-top">
|
||||||
<h5>Sections</h5>
|
<h5>Sections</h5>
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ var storage = {
|
||||||
|
|
||||||
getLocalStorage: function(key)
|
getLocalStorage: function(key)
|
||||||
{
|
{
|
||||||
// console.log(key);
|
console.log(key);
|
||||||
return this.parseJSON2Native(localStorage.getItem(key));
|
return this.parseJSON2Native(localStorage.getItem(key));
|
||||||
},
|
},
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue