Add focused prop to status

This commit is contained in:
wakarimasen 2017-03-05 16:31:01 +01:00
parent 22e8258a56
commit 289326855c
4 changed files with 7 additions and 7 deletions

View File

@ -47,6 +47,9 @@ const conversation = {
.then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] })) .then((status) => this.$store.dispatch('addNewStatuses', { statuses: [status] }))
.then(() => this.fetchConversation()) .then(() => this.fetchConversation())
} }
},
focused: function(id) {
return (id == this.statusoid.id)
} }
} }
} }

View File

@ -8,7 +8,7 @@
</div> </div>
<div class="panel-body"> <div class="panel-body">
<div class="timeline"> <div class="timeline">
<status v-for="status in conversation" :key="status.id" v-bind:statusoid="status":expandable='false'></status> <status v-for="status in conversation" :key="status.id" v-bind:statusoid="status":expandable='false':focused="focused(status.id)"></status>
</div> </div>
</div> </div>
</div> </div>

View File

@ -9,7 +9,8 @@ import { toInteger } from 'lodash'
const Status = { const Status = {
props: [ props: [
'statusoid', 'statusoid',
'expandable' 'expandable',
'focused'
], ],
data: () => ({ data: () => ({
replying: false, replying: false,
@ -32,10 +33,6 @@ const Status = {
return !!this.$store.state.users.currentUser return !!this.$store.state.users.currentUser
}, },
muted () { return !this.unmuted && this.status.user.muted }, muted () { return !this.unmuted && this.status.user.muted },
focused () {
const id = toInteger(this.$route.params.id)
return (this.statusoid.id == id)
},
isReply () { return !!this.statusoid.in_reply_to_status_id } isReply () { return !!this.statusoid.in_reply_to_status_id }
}, },
components: { components: {

View File

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<conversation v-if="expanded" @toggleExpanded="toggleExpanded" :collapsable="true" :statusoid="statusoid"></conversation> <conversation v-if="expanded" @toggleExpanded="toggleExpanded" :collapsable="true" :statusoid="statusoid"></conversation>
<status v-if="!expanded" @toggleExpanded="toggleExpanded" :expandable="true" :statusoid="statusoid"></status> <status v-if="!expanded" @toggleExpanded="toggleExpanded" :expandable="true" :statusoid="statusoid" :focused="false"></status>
</div> </div>
</template> </template>