Rich welcome content (#7588)

* Add rich content (polls, media) to the welcome page notes

* Add a simple scrolling animation to welcome page
This commit is contained in:
Skehmatics
2021-07-09 10:55:12 -07:00
committed by GitHub
parent 38474c7316
commit cb42f94d9c
2 changed files with 68 additions and 15 deletions

View File

@ -10,7 +10,7 @@
</span>
</li>
</ul>
<p>
<p v-if="!readOnly">
<span>{{ $t('_poll.totalVotes', { n: total }) }}</span>
<span> · </span>
<a v-if="!closed && !isVoted" @click="toggleShowResult">{{ showResult ? $ts._poll.vote : $ts._poll.showResult }}</a>
@ -31,6 +31,11 @@ export default defineComponent({
note: {
type: Object,
required: true
},
readOnly: {
type: Boolean,
required: false,
default: false,
}
},
data() {
@ -65,7 +70,7 @@ export default defineComponent({
}
},
created() {
this.showResult = this.isVoted;
this.showResult = this.readOnly || this.isVoted;
if (this.note.poll.expiresAt) {
const update = () => {
@ -83,7 +88,7 @@ export default defineComponent({
this.showResult = !this.showResult;
},
vote(id) {
if (this.closed || !this.poll.multiple && this.poll.choices.some(c => c.isVoted)) return;
if (this.readOnly || this.closed || !this.poll.multiple && this.poll.choices.some(c => c.isVoted)) return;
os.api('notes/polls/vote', {
noteId: this.note.id,
choice: id