Add replies.

This commit is contained in:
Roger Braun 2016-11-03 16:59:27 +01:00
parent 78538da82f
commit 7e2c52b12c
3 changed files with 25 additions and 8 deletions

View file

@ -1,16 +1,20 @@
import statusPoster from '../../services/status_poster/status_poster.service.js' import statusPoster from '../../services/status_poster/status_poster.service.js'
const PostStatusForm = { const PostStatusForm = {
data() { props: [
'replyTo'
],
data () {
return { return {
newStatus: { } newStatus: { }
} }
}, },
methods: { methods: {
postStatus(newStatus) { postStatus (newStatus) {
statusPoster.postStatus({ statusPoster.postStatus({
status: newStatus.status, status: newStatus.status,
store: this.$store store: this.$store,
inReplyToStatusId: this.replyTo
}) })
this.newStatus = { } this.newStatus = { }
} }

View file

@ -1,8 +1,12 @@
import Attachment from '../attachment/attachment.vue' import Attachment from '../attachment/attachment.vue'
import FavoriteButton from '../favorite_button/favorite_button.vue' import FavoriteButton from '../favorite_button/favorite_button.vue'
import PostStatusForm from '../post_status_form/post_status_form.vue'
const Status = { const Status = {
props: [ 'statusoid' ], props: [ 'statusoid' ],
data: () => ({
replying: false
}),
computed: { computed: {
retweet () { return !!this.statusoid.retweeted_status }, retweet () { return !!this.statusoid.retweeted_status },
retweeter () { return this.statusoid.user.name }, retweeter () { return this.statusoid.user.name },
@ -16,7 +20,13 @@ const Status = {
}, },
components: { components: {
Attachment, Attachment,
FavoriteButton FavoriteButton,
PostStatusForm
},
methods: {
toggleReplying () {
this.replying = !this.replying
}
} }
} }

View file

@ -2,7 +2,7 @@
<div class="status-el"> <div class="status-el">
<div v-if="retweet" class="media container retweet-info"> <div v-if="retweet" class="media container retweet-info">
<div class="media-left"> <div class="media-left">
<i class='fa fa-retweet'></i> <i class='fa icon-retweet'></i>
</div> </div>
<div class="media-body"> <div class="media-body">
Retweeted by {{retweeter}} Retweeted by {{retweeter}}
@ -34,8 +34,10 @@
<div> <div>
<div class='status-actions'> <div class='status-actions'>
<div ng-click="toggleReplying()"> <div>
<i class='fa icon-reply'></i> <a href="#" v-on:click.prevent="toggleReplying()">
<i class='fa icon-reply'></i>
</a>
</div> </div>
<div> <div>
<i class='fa icon-retweet'></i> <i class='fa icon-retweet'></i>
@ -43,7 +45,7 @@
<favorite-button :status=status></favorite-button> <favorite-button :status=status></favorite-button>
</div> </div>
<!-- <post-status-form ng-if="replying" toggle="toggleReplying" reply-to-status="status" reply-to="{{status.id}}"></post-status-form> --> <post-status-form v-if="replying" :reply-to="status.id"></post-status-form>
</div> </div>
</div> </div>
</div> </div>
@ -55,6 +57,7 @@
<style lang="scss"> <style lang="scss">
.status-el { .status-el {
word-wrap: break-word; word-wrap: break-word;
word-break: break-word;
a { a {
word-break: break-all; word-break: break-all;