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> <template>
<div> <div>
<ul class="file-list"> <ul class="file-list">
<li @click="select" <li @click="itemClick"
@touchstart="touchstart" @touchstart="touchstart"
@dblclick="next" @dblclick="next"
role="button" role="button"
@ -35,7 +35,7 @@ export default {
} }
}, },
computed: { computed: {
...mapState([ 'req' ]), ...mapState([ 'req', 'user' ]),
nav () { nav () {
return decodeURIComponent(this.current) return decodeURIComponent(this.current)
} }
@ -111,6 +111,10 @@ export default {
this.next(event) this.next(event)
} }
}, },
itemClick: function (event) {
if (this.user.singleClick) this.next(event)
else this.select(event)
},
select: function (event) { select: function (event) {
// If the element is already selected, unselect it. // If the element is already selected, unselect it.
if (this.selected === event.currentTarget.dataset.url) { 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') }} <input type="checkbox" :disabled="user.perm.admin" v-model="user.lockPassword"> {{ $t('settings.lockPassword') }}
</p> </p>
<p>
<input type="checkbox" v-model="user.singleClick"> {{ $t('settings.singleClick') }}
</p>
<permissions :perm.sync="user.perm" /> <permissions :perm.sync="user.perm" />
<commands v-if="isExecEnabled" :commands.sync="user.commands" /> <commands v-if="isExecEnabled" :commands.sync="user.commands" />

View File

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