diff options
author | Bastien Wirtz <bastien.wirtz@gmail.com> | 2021-03-06 22:09:58 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-06 22:09:58 -0800 |
commit | 00b46a6ddebcbbe581f201bd4089c38f6d666fb9 (patch) | |
tree | e26dd615b3adf273b99e58329b8caa2050c1d308 /src | |
parent | cc7ff885527283d97f32347210b0370e8477c4ff (diff) | |
parent | c6267296ec03db24ff40959ef58eedcec904c39b (diff) | |
download | homer-00b46a6ddebcbbe581f201bd4089c38f6d666fb9.tar.gz homer-00b46a6ddebcbbe581f201bd4089c38f6d666fb9.tar.zst homer-00b46a6ddebcbbe581f201bd4089c38f6d666fb9.zip |
Merge pull request #177 from luixal/multiple-pages
Adds multiple pages based on different config files
Diffstat (limited to 'src')
-rw-r--r-- | src/App.vue | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/App.vue b/src/App.vue index dc473ca..cd1d9ba 100644 --- a/src/App.vue +++ b/src/App.vue | |||
@@ -13,7 +13,7 @@ | |||
13 | <section v-if="config.header" class="first-line"> | 13 | <section v-if="config.header" class="first-line"> |
14 | <div v-cloak class="container"> | 14 | <div v-cloak class="container"> |
15 | <div class="logo"> | 15 | <div class="logo"> |
16 | <img v-if="config.logo" :src="config.logo" alt="dashboard logo" /> | 16 | <a href="#"><img v-if="config.logo" :src="config.logo" alt="dashboard logo" /></a> |
17 | <i v-if="config.icon" :class="config.icon"></i> | 17 | <i v-if="config.icon" :class="config.icon"></i> |
18 | </div> | 18 | </div> |
19 | <div class="dashboard-title"> | 19 | <div class="dashboard-title"> |
@@ -151,8 +151,16 @@ export default { | |||
151 | created: async function () { | 151 | created: async function () { |
152 | const defaults = jsyaml.load(defaultConfig); | 152 | const defaults = jsyaml.load(defaultConfig); |
153 | let config; | 153 | let config; |
154 | window.onhashchange = function() { location.reload(); }; | ||
154 | try { | 155 | try { |
155 | config = await this.getConfig(); | 156 | config = await this.getConfig(); |
157 | const path = (window.location.hash.substring(1) != '') ? window.location.hash.substring(1) : null; | ||
158 | if (path) { | ||
159 | let pathConfig = await this.getConfig(`assets/${path}.yml`); // the slash (/) is included in the pathname | ||
160 | for (const prop in pathConfig) config[prop] = pathConfig[prop]; | ||
161 | } | ||
162 | // config = await this.getConfig(path ? `assets/${path}.yml` : null); | ||
163 | //config = await (path ? this.getConfig(`assets/${path}.yml`) : this.getConfig()) | ||
156 | } catch (error) { | 164 | } catch (error) { |
157 | console.log(error); | 165 | console.log(error); |
158 | config = this.handleErrors("⚠️ Error loading configuration", error); | 166 | config = this.handleErrors("⚠️ Error loading configuration", error); |