Ver código fonte

Create ThreadPoll component and add to thread route

sbkwgh 8 anos atrás
pai
commit
f5ef0d3ae8

+ 25 - 0
src/components/ThreadPoll.vue

@@ -0,0 +1,25 @@
+<template>
+	<div class='poll'>
+	
+	</div>
+</template>
+
+<script>
+	import LoadingIcon from './LoadingIcon'
+
+	import AjaxErrorHandler from '../assets/js/errorHandler'
+
+	export default {
+		name: 'ThreadPoll',
+		props: ['id'],
+		components: { LoadingIcon }
+	}
+</script>
+
+<style lang='scss' scoped>
+	@import '../assets/scss/variables.scss';
+
+	.poll {
+
+	}
+</style>

+ 8 - 1
src/components/routes/Thread.vue

@@ -76,6 +76,11 @@
 			You can't post in this thread because it has been locked by an administrator
 		</div>
 
+		<thread-poll
+			v-if='$store.state.thread.PollQuestionId'
+			:id='$store.state.thread.PollQuestionId'
+		></thread-poll>
+
 		<div class='posts'>
 			<scroll-load
 				@loadNext='loadNextPosts'
@@ -126,6 +131,7 @@
 	import PostScrubber from '../PostScrubber'
 	import MenuButton from '../MenuButton'
 	import LoadingButton from '../LoadingButton'
+	import ThreadPoll from '../ThreadPoll'
 
 	import AjaxErrorHandler from '../../assets/js/errorHandler'
 	import logger from '../../assets/js/logger'
@@ -142,7 +148,8 @@
 			ThreadPostPlaceholder,
 			PostScrubber,
 			MenuButton,
-			LoadingButton
+			LoadingButton,
+			ThreadPoll
 		},
 		data () {
 			return {

+ 2 - 0
src/store/modules/thread.js

@@ -3,6 +3,7 @@ import AjaxErrorHandler from '../../assets/js/errorHandler'
 const state = {
 	thread: '',
 	threadId: undefined,
+	PollQuestionId: null,
 	posts: [],
 	postNotification: null,
 	locked: false,
@@ -255,6 +256,7 @@ const mutations = {
 	setThread (state, obj) {
 		state.thread = obj.name
 		state.threadId = obj.id
+		state.PollQuestionId = obj.PollQuestionId
 	},
 	setNextURL (state, URL) {
 		state.nextURL = URL