FIX: Float site settings were marked as overridden, reset didn't work.
This commit is contained in:
parent
d35633deab
commit
33de48dc0c
|
@ -47,20 +47,15 @@ Discourse.SiteSetting = Discourse.Model.extend({
|
||||||
return this.get('originalValue') !== this.get('value');
|
return this.get('originalValue') !== this.get('value');
|
||||||
}.property('originalValue', 'value'),
|
}.property('originalValue', 'value'),
|
||||||
|
|
||||||
/**
|
|
||||||
Has the setting been overridden from its default value?
|
|
||||||
|
|
||||||
@property overridden
|
|
||||||
**/
|
|
||||||
overridden: function() {
|
overridden: function() {
|
||||||
var val = this.get('value');
|
var val = this.get('value'),
|
||||||
var defaultVal = this.get('default');
|
defaultVal = this.get('default');
|
||||||
|
|
||||||
if (val === null) val = '';
|
if (val === null) val = '';
|
||||||
if (defaultVal === null) defaultVal = '';
|
if (defaultVal === null) defaultVal = '';
|
||||||
|
|
||||||
return val.toString() !== defaultVal.toString();
|
return val.toString() !== defaultVal.toString();
|
||||||
}.property('value'),
|
}.property('value', 'default'),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reset the setting to its original value.
|
Reset the setting to its original value.
|
||||||
|
|
|
@ -131,7 +131,7 @@ module SiteSettingExtension
|
||||||
opts = {
|
opts = {
|
||||||
setting: s,
|
setting: s,
|
||||||
description: description(s),
|
description: description(s),
|
||||||
default: v,
|
default: v.to_s,
|
||||||
type: type.to_s,
|
type: type.to_s,
|
||||||
value: value.to_s,
|
value: value.to_s,
|
||||||
category: categories[s]
|
category: categories[s]
|
||||||
|
@ -328,6 +328,8 @@ module SiteSettingExtension
|
||||||
|
|
||||||
def convert(value, type)
|
def convert(value, type)
|
||||||
case type
|
case type
|
||||||
|
when types[:float]
|
||||||
|
value.to_f
|
||||||
when types[:fixnum]
|
when types[:fixnum]
|
||||||
value.to_i
|
value.to_i
|
||||||
when types[:string], types[:list], types[:enum]
|
when types[:string], types[:list], types[:enum]
|
||||||
|
|
Loading…
Reference in New Issue