Parcourir la source

Add showDescription toggle functionality, replace the commit 'setForumName' and 'setForumDescription' with the generic 'setSettings'

sbkwgh il y a 8 ans
Parent
commit
214a97a4d3

+ 1 - 3
frontend/src/App.vue

@@ -326,9 +326,7 @@
 		created () {
 			this.axios.get('/api/v1/settings')
 				.then(res => {
-					this.$store.commit('setForumName', res.data.forumName)
-					this.$store.commit('setForumDescription', res.data.forumDescription)
-
+					this.$store.commit('setSettings', res.data)
 					this.$store.dispatch('setTitle', this.$store.state.meta.title)
 				}).catch(err => {
 					if(err.response.data.errors[0].name === 'noSettings') {

+ 6 - 3
frontend/src/components/AdminForumInfo.vue

@@ -39,7 +39,7 @@
 			return {
 				name: '',
 				description: '',
-				showDescription: true,
+				showDescription: false,
 				loading: false,
 				errors: {
 					forumName: '',
@@ -61,12 +61,14 @@
 
 				let settingsReq = this.axios.put('/api/v1/settings', {
 					forumName: this.name,
-					forumDescription: this.description
+					forumDescription: this.description,
+					showDescription: this.showDescription
 				})
 
 				settingsReq.then(res => {
 					this.loading = false
-					this.$store.commit('setForumName', res.data.forumName)
+					
+					this.$store.commit('setSettings', res.data)
 				}).catch(e => {
 					this.loading = false
 
@@ -86,6 +88,7 @@
 				.then(res => {
 					this.name = res.data.forumName || ''
 					this.description = res.data.forumDescription || ''
+					this.showDescription = res.data.showDescription
 				})
 				.catch(AjaxErrorHandler(this.$store))
 		}

+ 3 - 0
frontend/src/components/routes/Index.vue

@@ -1,5 +1,8 @@
 <template>
 	<div class='route_container'>
+		<div class='forum_description' v-if='$store.state.meta.showDescription'>
+			{{$store.state.meta.description}}
+		</div>
 		<div class='thread_sorting'>
 			<select-options
 				:options='filterOptions'

+ 1 - 1
frontend/src/components/routes/Start.vue

@@ -205,7 +205,7 @@
 
 				settingsReq.then(res => {
 					this.loading = false
-					this.$store.commit('setForumName', res.data.forumName)
+					this.$store.commit('setSettings', res.data)
 					this.panel = 3
 				}).catch(this.errorCallback)
 			},