Cleanup boolean/choice setting

This commit is contained in:
Henry Jameson 2021-03-11 17:04:31 +02:00
parent 8e88d8110b
commit 2da37f15ab
2 changed files with 2 additions and 38 deletions

View File

@ -18,40 +18,4 @@
</label> </label>
</template> </template>
<script> <script src="./boolean_setting.js"></script>
import { get, set } from 'lodash'
import Checkbox from 'src/components/checkbox/checkbox.vue'
import ModifiedIndicator from './modified_indicator.vue'
export default {
components: {
Checkbox,
ModifiedIndicator
},
props: [
'path',
'disabled'
],
computed: {
pathDefault () {
const [firstSegment, ...rest] = this.path.split('.')
return [firstSegment + 'DefaultValue', ...rest].join('.')
},
state () {
return get(this.$parent, this.path)
},
isChanged () {
return get(this.$parent, this.path) !== get(this.$parent, this.pathDefault)
}
},
methods: {
update (e) {
set(this.$parent, this.path, e)
}
}
}
</script>
<style lang="scss">
.BooleanSetting {
}
</style>

View File

@ -14,7 +14,7 @@
:value="option.value" :value="option.value"
> >
{{ option.label }} {{ option.label }}
{{ option.value === defaultValue ? $t('settings.instance_default_simple') : '' }} {{ option.value === defaultState ? $t('settings.instance_default_simple') : '' }}
</option> </option>
</Select> </Select>
<ModifiedIndicator :changed="isChanged" /> <ModifiedIndicator :changed="isChanged" />