diff options
| author | Henry Jameson <me@hjkos.com> | 2021-04-07 20:53:58 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2021-04-07 20:53:58 +0300 |
| commit | 1afda1ac6d037e477e500870fe4e05c3c1f773cb (patch) | |
| tree | 33abb524f783c66c0ff12ead4d1f10ff396579b6 | |
| parent | 0c77a3e1d6956c14b68078ff766c5ccfb6b086a4 (diff) | |
lost file
| -rw-r--r-- | src/components/settings_modal/helpers/boolean_setting.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/components/settings_modal/helpers/boolean_setting.js b/src/components/settings_modal/helpers/boolean_setting.js new file mode 100644 index 00000000..1dda49f2 --- /dev/null +++ b/src/components/settings_modal/helpers/boolean_setting.js @@ -0,0 +1,30 @@ +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) + } + } +} |
