Close poll form after status submit
This commit is contained in:
parent
20766b8522
commit
f1a9a04451
|
@ -42,17 +42,16 @@ export default {
|
|||
methods: {
|
||||
onAddOption () {
|
||||
if (this.optionsLength < maxOptions) {
|
||||
this.$store.commit('addPollOption', '')
|
||||
this.$store.dispatch('addPollOption', { option: '' })
|
||||
}
|
||||
},
|
||||
onDeleteOption (index) {
|
||||
console.log(index)
|
||||
if (this.optionsLength > 1) {
|
||||
this.$store.commit('deletePollOption', index)
|
||||
this.$store.dispatch('deletePollOption', { index })
|
||||
}
|
||||
},
|
||||
onUpdateOption (e, index) {
|
||||
this.$store.commit('updatePollOption', { index, option: e.target.value })
|
||||
this.$store.dispatch('updatePollOption', { index, option: e.target.value })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -275,6 +275,8 @@ const PostStatusForm = {
|
|||
visibility: newStatus.visibility,
|
||||
contentType: newStatus.contentType
|
||||
}
|
||||
this.$store.dispatch('swapPollOptions', { options: ['', ''] })
|
||||
this.pollFormVisible = false
|
||||
this.$refs.mediaUpload.clearFile()
|
||||
this.$emit('posted')
|
||||
let el = this.$el.querySelector('textarea')
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<poll-form :visible="pollFormVisible" />
|
||||
<poll-form :visible="pollFormVisible" :options="newStatus.pollOptions" />
|
||||
<div class='form-bottom'>
|
||||
<media-upload ref="mediaUpload" @uploading="disableSubmit" @uploaded="addMediaFile" @upload-failed="uploadFailed" :drop-files="dropFiles"></media-upload>
|
||||
<div class="poll-icon">
|
||||
|
|
|
@ -3,14 +3,31 @@ const poll = {
|
|||
pollOptions: ['', '']
|
||||
},
|
||||
mutations: {
|
||||
addPollOption (state, option) {
|
||||
ADD_OPTION (state, { option }) {
|
||||
state.pollOptions.push(option)
|
||||
},
|
||||
updatePollOption (state, { index, option }) {
|
||||
UPDATE_OPTION (state, { index, option }) {
|
||||
state.pollOptions[index] = option
|
||||
},
|
||||
deletePollOption (state, index) {
|
||||
DELETE_OPTION (state, { index }) {
|
||||
state.pollOptions.splice(index, 1)
|
||||
},
|
||||
SWAP_OPTIONS (state, { options }) {
|
||||
state.pollOptions = options
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
addPollOption (store, { option }) {
|
||||
store.commit('ADD_OPTION', { option })
|
||||
},
|
||||
updatePollOption (store, { index, option }) {
|
||||
store.commit('UPDATE_OPTION', { index, option })
|
||||
},
|
||||
deletePollOption (store, { index }) {
|
||||
store.commit('DELETE_OPTION', { index })
|
||||
},
|
||||
swapPollOptions (store, { options }) {
|
||||
store.commit('SWAP_OPTIONS', { options })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue