Show motd everywhere

This commit is contained in:
kolaente 2019-12-25 17:38:49 +01:00
parent 9c66a7570a
commit a06e709da6
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -168,6 +168,14 @@
<div class="container">
<div class="column is-4 is-offset-4">
<img src="/images/logo-full.svg" alt="Vikunja"/>
<div class="message is-info" v-if="motd !== ''">
<div class="message-header">
<p>Info</p>
</div>
<div class="message-body">
{{ motd }}
</div>
</div>
<router-view/>
</div>
</div>
@ -207,6 +215,7 @@
userMenuActive: false,
authTypes: authTypes,
isOnline: true,
motd: '',
// Service Worker stuff
updateAvailable: false,
@ -253,6 +262,9 @@
setTimeout(() => {
auth.renewToken()
}, 1000 * 60 * 60)
// Set the motd
this.setMotd()
},
watch: {
// call the method again if the route changes
@ -299,6 +311,18 @@
// Notify the service worker to actually do the update
this.registration.waiting.postMessage('skipWaiting');
},
setMotd() {
let cancel = () => {};
// Since the config may not be initialized when we're calling this, we need to retry until it is ready.
if (typeof this.$config === 'undefined') {
cancel = setTimeout(() => {
this.setMotd()
}, 150)
} else {
cancel()
this.motd = this.$config.motd
}
},
},
}
</script>