Add support for enum site settings that render as a dropdown; use a dropdown for default_locale

This commit is contained in:
Neil Lalonde
2013-06-11 11:39:55 -04:00
parent c27d5dc2bd
commit 5ff7e570ac
9 changed files with 131 additions and 13 deletions

View File

@@ -0,0 +1,21 @@
class LocaleSiteSetting
def self.valid_value?(val)
supported_locales.include?(val)
end
def self.all_values
supported_locales
end
private
@lock = Mutex.new
def self.supported_locales
@lock.synchronize do
@supported_locales ||= Dir.glob( File.join(Rails.root, 'config', 'locales', 'client.*.yml') ).map {|x| x.split('.')[-2]}
end
end
end

View File

@@ -203,7 +203,7 @@ class SiteSetting < ActiveRecord::Base
setting(:title_fancy_entities, true)
# The default locale for the site
setting(:default_locale, 'en')
setting(:default_locale, 'en', enum: 'LocaleSiteSetting')
client_setting(:educate_until_posts, 2)