Fix "max depth in thread" setting
This commit is contained in:
parent
48178bdc53
commit
551b8f3690
37
src/components/settings_modal/helpers/integer_setting.js
Normal file
37
src/components/settings_modal/helpers/integer_setting.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { get, set } from 'lodash'
|
||||||
|
import ModifiedIndicator from './modified_indicator.vue'
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
ModifiedIndicator
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
path: String,
|
||||||
|
disabled: Boolean,
|
||||||
|
min: Number
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
pathDefault () {
|
||||||
|
const [firstSegment, ...rest] = this.path.split('.')
|
||||||
|
return [firstSegment + 'DefaultValue', ...rest].join('.')
|
||||||
|
},
|
||||||
|
state () {
|
||||||
|
const value = get(this.$parent, this.path)
|
||||||
|
if (value === undefined) {
|
||||||
|
return this.defaultState
|
||||||
|
} else {
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
},
|
||||||
|
defaultState () {
|
||||||
|
return get(this.$parent, this.pathDefault)
|
||||||
|
},
|
||||||
|
isChanged () {
|
||||||
|
return this.state !== this.defaultState
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
update (e) {
|
||||||
|
set(this.$parent, this.path, parseInt(e.target.value))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
20
src/components/settings_modal/helpers/integer_setting.vue
Normal file
20
src/components/settings_modal/helpers/integer_setting.vue
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<template>
|
||||||
|
<span class="IntegerSetting">
|
||||||
|
<label :for="path">
|
||||||
|
<slot />
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
:id="path"
|
||||||
|
class="number-input"
|
||||||
|
type="number"
|
||||||
|
step="1"
|
||||||
|
:disabled="disabled"
|
||||||
|
:min="min || 0"
|
||||||
|
:value="state"
|
||||||
|
@change="update"
|
||||||
|
>
|
||||||
|
<ModifiedIndicator :changed="isChanged" />
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script src="./integer_setting.js"></script>
|
@ -1,6 +1,7 @@
|
|||||||
import { filter, trim } from 'lodash'
|
import { filter, trim } from 'lodash'
|
||||||
import BooleanSetting from '../helpers/boolean_setting.vue'
|
import BooleanSetting from '../helpers/boolean_setting.vue'
|
||||||
import ChoiceSetting from '../helpers/choice_setting.vue'
|
import ChoiceSetting from '../helpers/choice_setting.vue'
|
||||||
|
import IntegerSetting from '../helpers/integer_setting.vue'
|
||||||
|
|
||||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
|
|
||||||
@ -17,7 +18,8 @@ const FilteringTab = {
|
|||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
BooleanSetting,
|
BooleanSetting,
|
||||||
ChoiceSetting
|
ChoiceSetting,
|
||||||
|
IntegerSetting
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...SharedComputedObject(),
|
...SharedComputedObject(),
|
||||||
|
@ -60,17 +60,12 @@
|
|||||||
</li>
|
</li>
|
||||||
<h3>{{ $t('settings.attachments') }}</h3>
|
<h3>{{ $t('settings.attachments') }}</h3>
|
||||||
<li>
|
<li>
|
||||||
<label for="maxThumbnails">
|
<IntegerSetting
|
||||||
{{ $t('settings.max_thumbnails') }}
|
path="maxThumbnails"
|
||||||
</label>
|
:min="0"
|
||||||
<input
|
|
||||||
id="maxThumbnails"
|
|
||||||
path.number="maxThumbnails"
|
|
||||||
class="number-input"
|
|
||||||
type="number"
|
|
||||||
min="0"
|
|
||||||
step="1"
|
|
||||||
>
|
>
|
||||||
|
{{ $t('settings.max_thumbnails') }}
|
||||||
|
</IntegerSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<BooleanSetting path="hideAttachments">
|
<BooleanSetting path="hideAttachments">
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import BooleanSetting from '../helpers/boolean_setting.vue'
|
import BooleanSetting from '../helpers/boolean_setting.vue'
|
||||||
import ChoiceSetting from '../helpers/choice_setting.vue'
|
import ChoiceSetting from '../helpers/choice_setting.vue'
|
||||||
|
import IntegerSetting from '../helpers/integer_setting.vue'
|
||||||
import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
|
import InterfaceLanguageSwitcher from 'src/components/interface_language_switcher/interface_language_switcher.vue'
|
||||||
|
|
||||||
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
import SharedComputedObject from '../helpers/shared_computed_object.js'
|
||||||
@ -47,6 +48,7 @@ const GeneralTab = {
|
|||||||
components: {
|
components: {
|
||||||
BooleanSetting,
|
BooleanSetting,
|
||||||
ChoiceSetting,
|
ChoiceSetting,
|
||||||
|
IntegerSetting,
|
||||||
InterfaceLanguageSwitcher
|
InterfaceLanguageSwitcher
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -176,17 +176,12 @@
|
|||||||
</BooleanSetting>
|
</BooleanSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<label for="maxDepthInThread">
|
<IntegerSetting
|
||||||
{{ $t('settings.max_depth_in_thread') }}
|
path="maxDepthInThread"
|
||||||
</label>
|
:min="3"
|
||||||
<input
|
|
||||||
id="maxDepthInThread"
|
|
||||||
path.number="maxDepthInThread"
|
|
||||||
class="number-input"
|
|
||||||
type="number"
|
|
||||||
min="3"
|
|
||||||
step="1"
|
|
||||||
>
|
>
|
||||||
|
{{ $t('settings.max_depth_in_thread') }}
|
||||||
|
</IntegerSetting>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<ChoiceSetting
|
<ChoiceSetting
|
||||||
|
Loading…
Reference in New Issue
Block a user