mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 16:48:03 +08:00
FEATURE: Support additional metadata in theme about.json (#6944)
New `about.json` fields (all optional): - `authors`: An arbitrary string describing the theme authors - `theme_version`: An arbitrary string describing the theme version - `minimum_discourse_version`: Theme will be auto-disabled for lower versions. Must be a valid version descriptor. - `maximum_discourse_version`: Theme will be auto-disabled for lower versions. Must be a valid version descriptor. A localized description for a theme can be provided in the language files under the `theme_metadata.description` key The admin UI has been re-arranged to display this new information, and give more prominence to the remote theme options.
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
class ThemeTranslationParser
|
||||
INTERNAL_KEYS = [:theme_metadata]
|
||||
class InvalidYaml < StandardError; end
|
||||
|
||||
def initialize(setting_field)
|
||||
def initialize(setting_field, internal: internal)
|
||||
@setting_field = setting_field
|
||||
@internal = internal
|
||||
end
|
||||
|
||||
def self.check_contains_hashes(hash)
|
||||
@ -22,6 +24,9 @@ class ThemeTranslationParser
|
||||
|
||||
parsed.deep_symbolize_keys!
|
||||
|
||||
parsed[@setting_field.name.to_sym].slice!(*INTERNAL_KEYS) if @internal
|
||||
parsed[@setting_field.name.to_sym].except!(*INTERNAL_KEYS) if !@internal
|
||||
|
||||
parsed
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user