Add ability to reply from an entry

This commit is contained in:
Peter Stuifzand 2018-08-30 19:56:29 +02:00
parent dcd79702db
commit 246ba75ee0
5 changed files with 83 additions and 40 deletions

11
TODO.md
View File

@ -2,11 +2,7 @@
## Some features that need to be implemented ## Some features that need to be implemented
- Get Microsub endpoint from homepage of user
- Micropub - Micropub
- Like
- Reply
- Repost
- Bookmark? - Bookmark?
- Infinite scrolling - Infinite scrolling
- Scrolling backward and forward - Scrolling backward and forward
@ -21,6 +17,13 @@
micropub server support micropub server support
- Improve handling of entries with missing values (like missing author) - Improve handling of entries with missing values (like missing author)
## Completed
- Indieauth (needs CORS on the server)
- Get Microsub endpoint from homepage of user
- Micropub
- Like
- Repost
## Ideas ## Ideas

View File

@ -1,44 +1,54 @@
<template> <template>
<div :class="classes"> <div>
<div class="card-image" v-if="photo_first"> <div :class="classes">
<figure class="image"> <div class="card-image" v-if="photo_first">
<img :src="photo_first"/> <figure class="image">
</figure> <img :src="photo_first"/>
</div> </figure>
</div>
<div class="card-content"> <div class="card-content">
<div class="media"> <div class="media">
<div class="media-left"> <div class="media-left">
<figure class="image is-48x48"> <figure class="image is-48x48">
<img :src="author_photo"/> <img :src="author_photo"/>
</figure> </figure>
</div>
<div class="content">
<div><a :href="author_url">{{ author_name }}</a></div>
<h3 class="title is-6" v-if="item.name" v-text="item.name"></h3>
<div class="content" v-html="main_content"></div>
<div class="photos">
<div class="photo" v-for="photo in photo_rest" :key="photo">
<img :src="photo" class="image"/>
</div>
</div> </div>
<div class="debug" v-text="item" v-if="this.$store.state.debug"></div> <div class="content">
<div><a :href="author_url">{{ author_name }}</a></div>
<h3 class="title is-6" v-if="item.name" v-text="item.name"></h3>
<div class="content" v-html="main_content"></div>
<a :href="item.url" target="_new"> <div class="photos">
<span class="published" v-html="item.published"></span> <div class="photo" v-for="photo in photo_rest" :key="photo">
</a> <img :src="photo" class="image"/>
</div>
</div>
<div class="debug" v-text="item" v-if="this.$store.state.debug"></div>
<a :href="item.url" target="_new">
<span class="published" v-html="item.published"></span>
</a>
</div>
</div> </div>
</div> </div>
<footer class="card-footer">
<a class="card-footer-item" @click="debug">Debug</a>
<a class="card-footer-item" @click="like">Like</a>
<a class="card-footer-item" @click="repost">Repost</a>
<a class="card-footer-item" @click="openReply">Reply</a>
</footer>
</div>
<div class="card" v-if="replying">
<div class="card-content">
<textarea class="textarea" v-model="replyText"></textarea>
</div>
<footer class="card-footer">
<a class="card-footer-item" @click="reply">Reply</a>
</footer>
</div> </div>
<footer class="card-footer">
<a class="card-footer-item" @click="debug">Debug</a>
<a class="card-footer-item" @click="like">Like</a>
<a class="card-footer-item" @click="repost">Repost</a>
<a class="card-footer-item" @click.prevent="console.log('unimplemented')">Reply</a>
</footer>
</div> </div>
</template> </template>
@ -47,10 +57,32 @@
name: "Entry", name: "Entry",
props: ['item'], props: ['item'],
data() {
return {
'replying': false,
'replyText': ''
}
},
methods: { methods: {
debug() { debug() {
this.$emit('debug', this.item) this.$emit('debug', this.item)
}, },
openReply() {
this.replying = true
},
reply() {
this.$store.dispatch('micropubPost', {
'type': ['h-entry'],
'properties': {
'in-reply-to': [this.item.url],
'content': [this.replyText]
},
}).then(() => {
this.replyText = '';
this.replying = false
})
},
like() { like() {
this.$store.dispatch('micropubPost', { this.$store.dispatch('micropubPost', {
'type': ['h-entry'], 'type': ['h-entry'],
@ -71,7 +103,7 @@
computed: { computed: {
classes() { classes() {
return {'entry': true, 'card': true, 'unread': !this.item._is_read} return {'entry': true, 'card': true, 'mb-20': true, 'unread': !this.item._is_read}
}, },
main_content() { main_content() {
let content = this.item.content let content = this.item.content

View File

@ -53,7 +53,7 @@
this.$emit('getPage', {uid: this.channel.uid, before: this.timeline.paging.before}) this.$emit('getPage', {uid: this.channel.uid, before: this.timeline.paging.before})
}, },
markRead(channel, id) { markRead(channel, id) {
return this.$store.dispatch('markRead', {channel:channel, entry: id }) return this.$store.dispatch('markRead', {channel: channel, entry: id})
} }
}, },
@ -97,4 +97,8 @@
.timeline--item { .timeline--item {
margin-bottom: 16px; margin-bottom: 16px;
} }
.has-buttons {
justify-content: end;
padding:12px;
}
</style> </style>

View File

@ -3,7 +3,7 @@ import App from './App.vue'
import router from './router' import router from './router'
import store from './store' import store from './store'
import 'bulma' import 'bulma'
import '@/styles.scss'
Vue.config.productionTip = false Vue.config.productionTip = false

4
src/styles.scss Normal file
View File

@ -0,0 +1,4 @@
.mb-20 {
margin-bottom: 20px;
}