fix #308 - show login hint above timeline when user is not logged in

This commit is contained in:
Xiaofeng An 2019-02-05 13:47:27 -05:00
parent 8e51c78471
commit c758d103bd
3 changed files with 28 additions and 3 deletions

View file

@ -4,7 +4,8 @@ const PublicTimeline = {
Timeline Timeline
}, },
computed: { computed: {
timeline () { return this.$store.state.statuses.timelines.public } timeline () { return this.$store.state.statuses.timelines.public },
currentUser () { return this.$store.state.users.currentUser }
}, },
created () { created () {
this.$store.dispatch('startFetching', 'public') this.$store.dispatch('startFetching', 'public')

View file

@ -1,5 +1,28 @@
<template> <template>
<div>
<div v-if="!currentUser" class="login-hint panel panel-default">
<div class="panel-body">
<router-link :to="{ name: 'login' }">
{{ $t("login.hint") }}
</router-link>
</div>
</div>
<Timeline :title="$t('nav.public_tl')" v-bind:timeline="timeline" v-bind:timeline-name="'public'"/> <Timeline :title="$t('nav.public_tl')" v-bind:timeline="timeline" v-bind:timeline-name="'public'"/>
</div>
</template> </template>
<script src="./public_timeline.js"></script> <script src="./public_timeline.js"></script>
<style lang="scss">
@import '../../_variables.scss';
.login-hint {
text-align: center;
a {
display: inline-block;
padding: 1em 0px;
width: 100%;
}
}
</style>

View file

@ -28,7 +28,8 @@
"password": "Password", "password": "Password",
"placeholder": "e.g. lain", "placeholder": "e.g. lain",
"register": "Register", "register": "Register",
"username": "Username" "username": "Username",
"hint": "Log in to join discussion"
}, },
"nav": { "nav": {
"about": "About", "about": "About",