mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Restore textarea type for site settings
Currenty, no settings in core use this, but textareas will be useful in theme settings and plugins.
This commit is contained in:
@@ -6,7 +6,7 @@ module SiteSettings; end
|
||||
class SiteSettings::TypeSupervisor
|
||||
include SiteSettings::Validations
|
||||
|
||||
CONSUMED_OPTS = %i[enum choices type validator min max regex hidden regex_error allow_any list_type].freeze
|
||||
CONSUMED_OPTS = %i[enum choices type validator min max regex hidden regex_error allow_any list_type textarea].freeze
|
||||
VALIDATOR_OPTS = %i[min max regex hidden regex_error].freeze
|
||||
|
||||
# For plugins, so they can tell if a feature is supported
|
||||
@@ -65,11 +65,16 @@ class SiteSettings::TypeSupervisor
|
||||
@types = {}
|
||||
@allow_any = {}
|
||||
@list_type = {}
|
||||
@textareas = {}
|
||||
end
|
||||
|
||||
def load_setting(name_arg, opts = {})
|
||||
name = name_arg.to_sym
|
||||
|
||||
if opts[:textarea]
|
||||
@textareas[name] = opts[:textarea]
|
||||
end
|
||||
|
||||
if (enum = opts[:enum])
|
||||
@enums[name] = enum.is_a?(String) ? enum.constantize : enum
|
||||
opts[:type] ||= :enum
|
||||
@@ -148,6 +153,8 @@ class SiteSettings::TypeSupervisor
|
||||
|
||||
result[:choices] = @choices[name] if @choices.has_key? name
|
||||
result[:list_type] = @list_type[name] if @list_type.has_key? name
|
||||
result[:textarea] = @textareas[name] if @textareas.has_key? name
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user