Add server data to room entries

This commit is contained in:
Ramon Wenger 2018-09-05 10:19:02 +02:00
parent 56c22a9105
commit 8b15bc76e6
3 changed files with 22 additions and 8 deletions

View File

@ -2,14 +2,14 @@
<div class="user-widget"> <div class="user-widget">
<img class="user-widget__avatar" <img class="user-widget__avatar"
:src="avatar"> :src="avatar">
<span class="user-widget__name">{{name}}</span> <span class="user-widget__name">{{firstName}} {{lastName}}</span>
<span class="user-widget__date" v-if="date">{{date}}</span> <span class="user-widget__date" v-if="date">{{date}}</span>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
props: ['name', 'avatar', 'date'] props: ['firstName', 'lastName', 'avatar', 'date']
} }
</script> </script>

View File

@ -17,11 +17,28 @@
import UserWidget from '@/components/UserWidget.vue'; import UserWidget from '@/components/UserWidget.vue';
export default { export default {
props: ['title', 'teaser', 'image', 'author'], props: ['title', 'author', 'contents'],
components: { components: {
UserWidget UserWidget
},
computed: {
image() {
if (this.contents) {
let found = this.contents.find(c => c.type === 'image_url');
return found ? found.value.url : '';
}
return '';
},
teaser() {
// if (this.contents && this.contents.length) {
// if (this.contents[0].type === 'link')
// }
return '';
}
} }
} }
</script> </script>

View File

@ -12,7 +12,7 @@
</div> </div>
<div class="room__content"> <div class="room__content">
<add-room-entry></add-room-entry> <add-room-entry></add-room-entry>
<room-entry v-for="entry in entries" v-bind="entry" :key="entry.id"></room-entry> <room-entry v-for="entry in room.roomEntries" v-bind="entry" :key="entry.id"></room-entry>
</div> </div>
</div> </div>
</template> </template>
@ -42,7 +42,6 @@
created() { created() {
this.$store.dispatch('hideFilter'); this.$store.dispatch('hideFilter');
// this.$store.dispatch('setSpecialContainerClass', 'red');
}, },
data() { data() {
@ -139,9 +138,7 @@
manual: true, manual: true,
result({data, loading, networkStatus}) { result({data, loading, networkStatus}) {
if (!loading) { if (!loading) {
this.room = this.$getRidOfEdges(data).room this.room = Object.assign({}, this.$getRidOfEdges(data).room);
this.roomAppearance = this.room.appearance
this.roomEntries = this.room.roomEntries
} }
} }
} }