mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 11:13:16 +08:00
FEATURE: add support for upload
format in theme settings.
This commit is contained in:
parent
8c58319992
commit
884eea7a83
|
@ -16,7 +16,7 @@ class ThemeSetting < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def self.types
|
||||
@types ||= Enum.new(integer: 0, float: 1, string: 2, bool: 3, list: 4, enum: 5)
|
||||
@types ||= Enum.new(integer: 0, float: 1, string: 2, bool: 3, list: 4, enum: 5, upload: 6)
|
||||
end
|
||||
|
||||
def self.acceptable_value_for_type?(value, type)
|
||||
|
|
|
@ -96,7 +96,7 @@ en:
|
|||
optimized_link: Optimized image links are ephemeral and should not be included in theme source code.
|
||||
settings_errors:
|
||||
invalid_yaml: "Provided YAML is invalid."
|
||||
data_type_not_a_number: "Setting `%{name}` type is unsupported. Supported types are `integer`, `bool`, `list` and `enum`"
|
||||
data_type_not_a_number: "Setting `%{name}` type is unsupported. Supported types are `integer`, `bool`, `list`, `enum` and `upload`"
|
||||
name_too_long: "There is a setting with a too long name. Maximum length is 255"
|
||||
default_value_missing: "Setting `%{name}` has no default value"
|
||||
default_not_match_type: "Setting `%{name}` default value's type doesn't match with the setting type."
|
||||
|
|
|
@ -167,4 +167,7 @@ class ThemeSettingsManager
|
|||
@opts[:choices]
|
||||
end
|
||||
end
|
||||
|
||||
class Upload < self
|
||||
end
|
||||
end
|
||||
|
|
|
@ -68,3 +68,7 @@ enum_setting_03:
|
|||
- 10
|
||||
- 100
|
||||
- 1000
|
||||
|
||||
upload_setting:
|
||||
type: upload
|
||||
default: ""
|
||||
|
|
Loading…
Reference in New Issue
Block a user