mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
FIX: mutate value if numeric in enums
This commit is contained in:
parent
030c141383
commit
e0bee3a3bc
|
@ -1,4 +1,4 @@
|
|||
{{combo-box valueAttribute="value" content=setting.validValues value=value none=setting.allowsNone}}
|
||||
{{combo-box castInteger=true valueAttribute="value" content=setting.validValues value=value none=setting.allowsNone}}
|
||||
{{preview}}
|
||||
{{setting-validation-message message=validationMessage}}
|
||||
<div class='desc'>{{{unbound setting.description}}}</div>
|
||||
|
|
|
@ -13,8 +13,12 @@ export default Ember.Mixin.create({
|
|||
return content;
|
||||
},
|
||||
|
||||
_isNumeric(input) {
|
||||
return !isNaN(parseFloat(input)) && isFinite(input);
|
||||
},
|
||||
|
||||
_castInteger(value) {
|
||||
if (this.get("castInteger") === true && Ember.isPresent(value)) {
|
||||
if (this.get("castInteger") === true && Ember.isPresent(value) && this._isNumeric(value)) {
|
||||
return parseInt(value, 10);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user