diff --git a/app/app.js b/app/app.js index cc7cc97..e8fbd83 100644 --- a/app/app.js +++ b/app/app.js @@ -10,6 +10,7 @@ var router = new VueRouter({ routes: [ { path: '/', component: homeComponent }, + { path: '/settings', component: settingsComponent }, { path: '/section/basics', component: sectionBasicsComponent }, { path: '/section/work', component: sectionWorkComponent }, @@ -64,12 +65,11 @@ var app = new Vue({ created() { this.sections = models.newDefaultSections(); + this.settings = models.newDefaultSettings(); // this.versons = []; this.versions = storage.getLocalStorage("versions"); this.currentVersion = ""; - // console.log("this.sections=", this.sections); - //-- Register all components pageComponents.registerComponents(); @@ -89,15 +89,11 @@ var app = new Vue({ { this.loadCountryCodes(); this.loadFromStorage(); - this.currentVersion = this.$root.sections.meta.version + this.currentVersion = this.$root.sections.meta.version; // Quick Fix 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); - // console.log([this.versions[0],storage.getVersionedLocalStorage(this.versions[0])]); - // this.availableVersions = this.$root.availableVersions; + // this.$root.settings.versionswitcher = false; // storage.getLocalStorage("settings.versionswitcher") // Set the "current" main navigation item based on the current route. this.selectMenuItemForCurrentUrl(); @@ -173,8 +169,6 @@ var app = new Vue({ loadCountryCodes: function() { - // console.log("loadCountryCodes(): data", countryCodes); - this.countryCodes.push({ "code": "", "name": "--Select a country--" @@ -328,8 +322,6 @@ var app = new Vue({ var mySidebar = document.getElementById("mySidebar"); var overlayBg = document.getElementById("myOverlay"); - console.log("mySidebar=", mySidebar); - if (mySidebar.style.display === 'block') { mySidebar.style.display = 'none'; @@ -390,7 +382,6 @@ var app = new Vue({ for (let i = 0; i < elements.length; i++) { var element = elements[i]; - //console.log("element[" + i + "]=", element); // Get HREF from the element var linkHref = element.getAttribute("href"); @@ -520,7 +511,7 @@ var app = new Vue({ this.selectMenuItemForCurrentUrl(); // Set the current page details based on the component mapped to the active route. - var component = pageComponents.getComponentByPath(to.fullPath); + var component = pageComponents.getComponentByPath(to.fullPath); this.setActivePageByComponent(component); }, diff --git a/app/page_registration.js b/app/page_registration.js index 5bef120..5f851cd 100644 --- a/app/page_registration.js +++ b/app/page_registration.js @@ -81,6 +81,15 @@ var pageComponents = { fontAwesomeIcon: "fas fa-home" }); + this.registerComponent({ + id: "settings", + path: "#/settings", + type: "page", + title: "Settings", + description: "", + fontAwesomeIcon: "fas fa-cog" + }); + this.registerComponent({ id: "basics", path: "#/section/basics", diff --git a/components/section_meta.js b/components/section_meta.js index facb052..9b6029a 100644 --- a/components/section_meta.js +++ b/components/section_meta.js @@ -40,11 +40,7 @@ var sectionMetaComponent = { $data: { handler: function(val, oldVal) { - // Save the data to localStorage - //NOTE: I'm initially not concerned about performance here/ - //storage.setLocalStorage("section.basics", val); - console.log([val, oldVal]); - //this.$root.sections.basics = val; + }, deep: true } @@ -65,15 +61,7 @@ var sectionMetaComponent = { } this.$root.currentVersion = this.$root.sections.meta.version; storage.setLocalStorage("currentVersion",this.$root.currentVersion); - - /* - var oldVersion = this.$root.currentVersion; - var newVersion = this.$root.sections.meta.version; - storage.setVersionedLocalStorage(newVersion,"sections",this.$root.sections); - storage.setVersionedLocalStorage(oldVersion,"sections",null); - this.$root.currentVersion = newVersion; - storage.setLocalStorage("currentVersion",newVersion); - */ + } } diff --git a/components/settings.js b/components/settings.js new file mode 100644 index 0000000..8e89ffa --- /dev/null +++ b/components/settings.js @@ -0,0 +1,28 @@ +var settingsComponent = { + template: '#settings-template', + + mounted: function() + { + + }, + + destroyed: function() + { + + }, + + data: function() + { + return { + item: {} + }; + }, + + watch: { + + }, + + methods: { + + } +}; \ No newline at end of file diff --git a/components/version_switcher.js b/components/version_switcher.js new file mode 100644 index 0000000..00d8c2d --- /dev/null +++ b/components/version_switcher.js @@ -0,0 +1,41 @@ +Vue.component("version-switcher", { + template: '#version-switcher-template', + + + props: [ + 'forcevisible' + ], + + + + + mounted: function() + { + this.displayFormat = (this.format ? this.format : ""); + }, + + + + destroyed: function() + { + + }, + + + + data: function() + { + return { + item: {} + }; + }, + + + + methods: { + visible: function() + { + return this.forcevisible || this.$root.settings.versionswitcher; + } + } +}); \ No newline at end of file diff --git a/index.html b/index.html index efafd27..fac589c 100644 --- a/index.html +++ b/index.html @@ -47,14 +47,9 @@