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 { .media-upload {
font-size: 26px; font-size: 26px;
min-width: 50px; min-width: 50px;
flex: 0;
} }
.icon-upload { .icon-upload {

View File

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

View File

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

View File

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

View File

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