refs #874 Add polls form in new toot modal

This commit is contained in:
AkiraFukushima 2019-07-15 19:42:33 +09:00
parent 71f5b906ff
commit 7c346a039a
1 changed files with 46 additions and 1 deletions

View File

@ -14,6 +14,16 @@
</div>
<Status v-model="status" :opened="newTootModal" :fixCursorPos="hashtagInserting" @paste="onPaste" @toot="toot" />
</el-form>
<div class="poll" v-if="openPoll">
<ul class="poll-list">
<li class="poll-option" v-for="(option, id) in polls" v-bind:key="id">
<el-radio :disabled="true" :label="id">
<el-input :placeholder="`choice ${id}`" v-model="polls[id]" size="small"></el-input>
</el-radio>
</li>
</ul>
<el-button class="add-poll" type="info" size="small" @click="addPoll" plain>Add a choice</el-button>
</div>
<div class="preview">
<div class="image-wrapper" v-for="media in attachedMedias" v-bind:key="media.id">
<img :src="media.preview_url" class="preview-image" />
@ -40,6 +50,11 @@
</el-button>
<input name="image" type="file" class="image-input" ref="image" @change="onChangeImage" :key="attachedMediaId" />
</div>
<div class="poll">
<el-button size="small" type="text" @click="togglePollForm" :title="$t('modals.new_toot.poll')">
<icon name="poll"></icon>
</el-button>
</div>
<div class="privacy">
<el-dropdown trigger="click" @command="changeVisibility">
<el-button size="small" type="text" :title="$t('modals.new_toot.change_visibility')">
@ -132,7 +147,9 @@ export default {
status: '',
spoiler: '',
showContentWarning: false,
visibilityList: Visibility
visibilityList: Visibility,
openPoll: false,
polls: ['', '']
}
},
computed: {
@ -323,6 +340,12 @@ export default {
},
updateDescription(id, value) {
this.$store.commit('TimelineSpace/Modals/NewToot/updateMediaDescription', { id: id, description: value })
},
togglePollForm() {
this.openPoll = !this.openPoll
},
addPoll() {
this.polls.push('')
}
}
}
@ -355,6 +378,23 @@ export default {
}
}
.poll {
border-top: 1px solid #ebebeb;
.poll-list {
list-style: none;
padding-left: 16px;
.poll-option {
line-height: 38px;
}
}
.add-poll {
margin: 0 0 8px 40px;
}
}
.preview {
box-sizing: border-box;
display: flex;
@ -429,6 +469,11 @@ export default {
}
}
.poll {
float: left;
margin-left: 8px;
}
.privacy {
float: left;
margin-left: 8px;