chore: move single click to user profile page (#1236)

Single clicks applies to FileList component.
pull/1225/head^2^2
WeidiDeng 2021-01-12 07:15:26 +08:00 committed by GitHub
parent 05bb7c8553
commit c8257e848e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 8 deletions

View File

@ -1,7 +1,7 @@
<template>
<div>
<ul class="file-list">
<li @click="select"
<li @click="itemClick"
@touchstart="touchstart"
@dblclick="next"
role="button"
@ -35,7 +35,7 @@ export default {
}
},
computed: {
...mapState([ 'req' ]),
...mapState([ 'req', 'user' ]),
nav () {
return decodeURIComponent(this.current)
}
@ -111,6 +111,10 @@ export default {
this.next(event)
}
},
itemClick: function (event) {
if (this.user.singleClick) this.next(event)
else this.select(event)
},
select: function (event) {
// If the element is already selected, unselect it.
if (this.selected === event.currentTarget.dataset.url) {

View File

@ -24,10 +24,6 @@
<input type="checkbox" :disabled="user.perm.admin" v-model="user.lockPassword"> {{ $t('settings.lockPassword') }}
</p>
<p>
<input type="checkbox" v-model="user.singleClick"> {{ $t('settings.singleClick') }}
</p>
<permissions :perm.sync="user.perm" />
<commands v-if="isExecEnabled" :commands.sync="user.commands" />

View File

@ -7,6 +7,7 @@
<div class="card-content">
<p><input type="checkbox" v-model="hideDotfiles"> {{ $t('settings.hideDotfiles') }}</p>
<p><input type="checkbox" v-model="singleClick"> {{ $t('settings.singleClick') }}</p>
<h3>{{ $t('settings.language') }}</h3>
<languages class="input input--block" :locale.sync="locale"></languages>
</div>
@ -47,6 +48,8 @@ export default {
return {
password: '',
passwordConf: '',
hideDotfiles: false,
singleClick: false,
locale: ''
}
},
@ -69,6 +72,7 @@ export default {
created () {
this.locale = this.user.locale
this.hideDotfiles = this.user.hideDotfiles
this.singleClick = this.user.singleClick
},
methods: {
...mapMutations([ 'updateUser' ]),
@ -92,8 +96,8 @@ export default {
event.preventDefault()
try {
const data = { id: this.user.id, locale: this.locale, hideDotfiles: this.hideDotfiles }
await api.update(data, ['locale', 'hideDotfiles'])
const data = { id: this.user.id, locale: this.locale, hideDotfiles: this.hideDotfiles, singleClick: this.singleClick }
await api.update(data, ['locale', 'hideDotfiles', 'singleClick'])
this.updateUser(data)
this.$showSuccess(this.$t('settings.settingsUpdated'))
} catch (e) {