fix broken upload previews, fix poll visibility when logged out

This commit is contained in:
shpuld 2019-06-18 22:32:49 +03:00
parent 2e173d9072
commit 68037ec443
5 changed files with 40 additions and 26 deletions

View File

@ -14,7 +14,6 @@
.media-upload {
font-size: 26px;
min-width: 50px;
flex: 0;
}
.icon-upload {

View File

@ -24,8 +24,11 @@ export default {
expired () {
return Date.now() > Date.parse(this.poll.expires_at)
},
loggedIn () {
return this.$store.state.users.currentUser
},
showResults () {
return this.poll.voted || this.expired
return this.poll.voted || this.expired || !this.loggedIn
},
totalVotesCount () {
return this.poll.votes_count

View File

@ -291,7 +291,7 @@ const PostStatusForm = {
}
this.pollFormVisible = false
this.$refs.mediaUpload.clearFile()
this.$refs.pollForm.clear()
this.clearPollForm()
this.$emit('posted')
let el = this.$el.querySelector('textarea')
el.style.height = 'auto'
@ -368,6 +368,11 @@ const PostStatusForm = {
setPoll (poll) {
this.newStatus.poll = poll
},
clearPollForm () {
if (this.$refs.pollForm) {
this.$refs.pollForm.clear()
}
},
dismissScopeNotice () {
this.$store.dispatch('setOption', { name: 'hideScopeNotice', value: true })
}

View File

@ -104,14 +104,16 @@
@update-poll="setPoll"
/>
<div class='form-bottom'>
<div class='form-bottom-left'>
<media-upload ref="mediaUpload" @uploading="disableSubmit" @uploaded="addMediaFile" @upload-failed="uploadFailed" :drop-files="dropFiles"></media-upload>
<div v-if="pollsAvailable" class="poll-icon">
<label
class="btn btn-default"
<i
:title="$t('polls.add_poll')"
@click="togglePollForm">
<i class="icon-chart-bar" :class="pollFormVisible && 'selected'" />
</label>
@click="togglePollForm"
class="icon-chart-bar btn btn-default"
:class="pollFormVisible && 'selected'"
/>
</div>
</div>
<p v-if="isOverLengthLimit" class="error">{{ charactersLeft }}</p>
<p class="faint" v-else-if="hasStatusLengthLimit">{{ charactersLeft }}</p>
@ -191,6 +193,11 @@
}
}
.form-bottom-left {
display: flex;
flex: 1;
}
.text-format {
.only-format {
color: $fallback--faint;
@ -198,6 +205,20 @@
}
}
.poll-icon {
font-size: 26px;
flex: 1;
.selected {
color: $fallback--lightText;
color: var(--lightText, $fallback--lightText);
}
}
.icon-chart-bar {
cursor: pointer;
}
.error {
text-align: center;
@ -259,7 +280,6 @@
}
}
.btn {
cursor: pointer;
}
@ -315,17 +335,4 @@
z-index: 4;
}
}
.poll-icon {
font-size: 26px;
flex: 1;
.selected {
color: $fallback--lightText;
color: var(--lightText, $fallback--lightText);
}
}
.icon-chart-bar {
cursor: pointer;
}
</style>

View File

@ -101,7 +101,7 @@
"single_choice": "Single choice",
"multiple_choices": "Multiple choices",
"expiry": "Poll age",
"expires_in": "Ends in {0}",
"expires_in": "Poll ends in {0}",
"expired": "Poll ended {0} ago",
"not_enough_options": "Too few unique options in poll"
},