This commit is contained in:
syuilo 2018-02-08 14:54:16 +09:00
parent 43525c4839
commit 941206922a
1 changed files with 44 additions and 48 deletions

View File

@ -1,19 +1,19 @@
<template>
<div :data-is-voted="isVoted">
<ul>
<li v-for="choice in poll.choices" :key="choice.id" @click="vote.bind(choice.id)" :class="{ voted: choice.voted }" :title="!choice.isVoted ? '%i18n:common.tags.mk-poll.vote-to%'.replace('{}', choice.text) : ''">
<li v-for="choice in poll.choices" :key="choice.id" @click="vote.bind(choice.id)" :class="{ voted: choice.voted }" :title="!isVoted ? '%i18n:common.tags.mk-poll.vote-to%'.replace('{}', choice.text) : ''">
<div class="backdrop" :style="{ 'width:' + (result ? (choice.votes / total * 100) : 0) + '%' }"></div>
<span>
<template v-if="is_voted">%fa:check%</template>
<template v-if="choice.is_voted">%fa:check%</template>
{{ text }}
<span class="votes" v-if="parent.result">({{ '%i18n:common.tags.mk-poll.vote-count%'.replace('{}', votes) }})</span>
<span class="votes" v-if="result">({{ '%i18n:common.tags.mk-poll.vote-count%'.replace('{}', choice.votes) }})</span>
</span>
</li>
</ul>
<p v-if="total > 0">
<span>{ '%i18n:common.tags.mk-poll.total-users%'.replace('{}', total) }</span>
<span>{{ '%i18n:common.tags.mk-poll.total-users%'.replace('{}', total) }}</span>
<a v-if="!isVoted" @click="toggleResult">{ result ? '%i18n:common.tags.mk-poll.vote%' : '%i18n:common.tags.mk-poll.show-result%' }</a>
<a v-if="!isVoted" @click="toggleResult">{{ result ? '%i18n:common.tags.mk-poll.vote%' : '%i18n:common.tags.mk-poll.show-result%' }}</a>
<span v-if="isVoted">%i18n:common.tags.mk-poll.voted%</span>
</p>
</div>
@ -59,8 +59,6 @@
};
</script>
<mk-poll data-is-voted={ isVoted }>
<style lang="stylus" scoped>
:scope
display block
@ -113,5 +111,3 @@
background transparent
</style>
</mk-poll>