fixes #18: introduce motd

This commit is contained in:
Davide Alberani 2017-03-04 20:34:02 +01:00
parent 4cbb8dca8a
commit b92b0799ac
2 changed files with 80 additions and 51 deletions

View file

@ -21,6 +21,18 @@
<md-switch v-model="shownSettings.protectDayNotes" class="md-warn">day notes</md-switch>
</div>
<br />
<div class="md-headline">
Message of the day
</div>
<md-switch v-model="shownSettings.showMotd" class="md-warn">show motd</md-switch>
<md-input-container>
<label>message</label>
<md-textarea v-model="shownSettings.motd"></md-textarea>
</md-input-container>
<br />
<md-button id="save-button" class="md-raised md-primary" @click="save()">Save</md-button>
</md-card-content>

View file

@ -1,4 +1,5 @@
<template>
<div>
<md-toolbar id="toolbar" class="md-dense">
<span v-if="currentPath != 'home' && currentPath != 'day' && currentPath != 'days'">
<md-button class="md-icon-button" @click="goBack()">
@ -52,9 +53,12 @@
<ibt-snackbar ref="snackbarObj" />
<ibt-dialog ref="dialogObj" />
</md-toolbar>
<vue-markdown v-if="settings.showMotd && settings.motd" class="motd" :source="settings.motd"></vue-markdown>
</div>
</template>
<script>
import VueMarkdown from 'vue-markdown';
import IbtDialog from './IbtDialog.vue';
import IbtSnackbar from './IbtSnackbar.vue';
@ -79,6 +83,10 @@ export default {
return '/user/' + this.loggedInUser._id;
},
settings() {
return this.$store.state.settings || {};
},
loggedInUser() {
return this.$store.state.loggedInUser;
},
@ -183,7 +191,7 @@ export default {
}
},
components: { IbtDialog, IbtSnackbar }
components: { IbtDialog, IbtSnackbar, VueMarkdown }
}
</script>
@ -254,4 +262,13 @@ export default {
color: white !important;
}
.motd p {
margin-top: 0px;
margin-bottom: 0px;
padding-top: 4px;
padding-bottom: 4px;
text-align: center;
background-color: #ffcdd2;
}
</style>