From 33de48dc0c47f4852f004d7fea57827a370a525d Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 20 Aug 2014 15:24:56 -0400 Subject: [PATCH] FIX: Float site settings were marked as overridden, reset didn't work. --- app/assets/javascripts/admin/models/site_setting.js | 11 +++-------- lib/site_setting_extension.rb | 4 +++- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/admin/models/site_setting.js b/app/assets/javascripts/admin/models/site_setting.js index 0b92c8bd773..2990d908cc0 100644 --- a/app/assets/javascripts/admin/models/site_setting.js +++ b/app/assets/javascripts/admin/models/site_setting.js @@ -47,20 +47,15 @@ Discourse.SiteSetting = Discourse.Model.extend({ return this.get('originalValue') !== this.get('value'); }.property('originalValue', 'value'), - /** - Has the setting been overridden from its default value? - - @property overridden - **/ overridden: function() { - var val = this.get('value'); - var defaultVal = this.get('default'); + var val = this.get('value'), + defaultVal = this.get('default'); if (val === null) val = ''; if (defaultVal === null) defaultVal = ''; return val.toString() !== defaultVal.toString(); - }.property('value'), + }.property('value', 'default'), /** Reset the setting to its original value. diff --git a/lib/site_setting_extension.rb b/lib/site_setting_extension.rb index eb87ac3bc4a..3bec7f0e674 100644 --- a/lib/site_setting_extension.rb +++ b/lib/site_setting_extension.rb @@ -131,7 +131,7 @@ module SiteSettingExtension opts = { setting: s, description: description(s), - default: v, + default: v.to_s, type: type.to_s, value: value.to_s, category: categories[s] @@ -328,6 +328,8 @@ module SiteSettingExtension def convert(value, type) case type + when types[:float] + value.to_f when types[:fixnum] value.to_i when types[:string], types[:list], types[:enum]