Skip to content

Commit

Permalink
Merge pull request #5557 from pymedusa/feature/fix-config-components
Browse files Browse the repository at this point in the history
Fix config/notifications page after breaking it in vueifying
  • Loading branch information
OmgImAlexis authored Oct 31, 2018
2 parents cf15ecf + 334a206 commit 1f06ce4
Show file tree
Hide file tree
Showing 11 changed files with 428 additions and 421 deletions.
2 changes: 1 addition & 1 deletion medusa/server/api/v2/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class ConfigHandler(BaseRequestHandler):

'notifiers.email.enabled': BooleanField(app, 'USE_EMAIL'),
'notifiers.email.host': StringField(app, 'EMAIL_HOST'),
'notifiers.email.port': StringField(app, 'EMAIL_PORT'),
'notifiers.email.port': IntegerField(app, 'EMAIL_PORT'),
'notifiers.email.from': StringField(app, 'EMAIL_FROM'),
'notifiers.email.tls': BooleanField(app, 'EMAIL_TLS'),
'notifiers.email.username': StringField(app, 'EMAIL_USER'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span>{{ label }}</span>
</label>
<div class="col-sm-10 content">
<input type="number" v-bind="{min, step, id, name: id, class: inputClass, placeholder}" v-model="localValue" @change="$emit('update', Number($event.target.value))"/>
<input type="number" v-bind="{min, step, id, name: id, class: inputClass, placeholder}" v-model="localValue" @input="updateValue()"/>
<p v-for="(explanation, index) in explanations" :key="index">{{ explanation }}</p>
<slot></slot>
</div>
Expand Down Expand Up @@ -69,6 +69,12 @@ export default {
const { value } = this;
this.localValue = value;
}
},
methods: {
updateValue() {
const { localValue } = this;
this.$emit('input', Number(localValue));
}
}
};
</script>
Expand Down
12 changes: 7 additions & 5 deletions themes-default/slim/src/components/helpers/config-textbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span>{{ label }}</span>
</label>
<div class="col-sm-10 content">
<input v-bind="{id, type, name: id, class: inputClass, placeholder}" v-model="localValue"/>
<input v-bind="{id, type, name: id, class: inputClass, placeholder}" v-model="localValue" @input="updateValue()"/>
<p v-for="(explanation, index) in explanations" :key="index">{{ explanation }}</p>
<slot></slot>
</div>
Expand Down Expand Up @@ -62,14 +62,16 @@ export default {
this.localValue = value;
},
watch: {
localValue() {
const { $emit, localValue } = this;
$emit('update', localValue);
},
value() {
const { value } = this;
this.localValue = value;
}
},
methods: {
updateValue() {
const { localValue } = this;
this.$emit('input', localValue);
}
}
};
</script>
Expand Down
24 changes: 13 additions & 11 deletions themes-default/slim/src/components/helpers/config-toggle-slider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<span>{{ label }}</span>
</label>
<div class="col-sm-10 content">
<toggle-button :width="45" :height="22" v-bind="{id, name: id, disabled}" v-model="localChecked" sync></toggle-button>
<toggle-button :width="45" :height="22" v-bind="{id, name: id, disabled}" v-model="localChecked" sync @input="updateValue()"></toggle-button>
<p v-for="(explanation, index) in explanations" :key="index">{{ explanation }}</p>
<slot></slot>
</div>
Expand All @@ -27,7 +27,7 @@ export default {
type: String,
required: true
},
checked: {
value: {
type: Boolean,
default: null
},
Expand All @@ -46,17 +46,19 @@ export default {
};
},
mounted() {
const { checked } = this;
this.localChecked = checked;
const { value } = this;
this.localChecked = value;
},
watch: {
checked() {
const { checked } = this;
this.localChecked = checked;
},
localChecked() {
const { $emit, localChecked } = this;
$emit('update', localChecked);
value() {
const { value } = this;
this.localChecked = value;
}
},
methods: {
updateValue() {
const { localChecked } = this;
this.$emit('input', localChecked);
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Generated by [AVA](https://ava.li).

> Snapshot 1
'<div id="config-toggle-slider-content"><div class="form-group"><div class="row"><label for="test-id" class="col-sm-2 control-label"><span>test-label</span></label><div class="col-sm-10 content"><togglebutton-stub width="45" height="22" sync="" id="test-id" name="test-id"></togglebutton-stub><p>explanation 1</p><p>explanation 2</p></div></div></div></div>'
'<div id="config-toggle-slider-content" checked="checked"><div class="form-group"><div class="row"><label for="test-id" class="col-sm-2 control-label"><span>test-label</span></label><div class="col-sm-10 content"><togglebutton-stub width="45" height="22" sync="" id="test-id" name="test-id"></togglebutton-stub><p>explanation 1</p><p>explanation 2</p></div></div></div></div>'
Binary file not shown.
Loading

0 comments on commit 1f06ce4

Please sign in to comment.