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:
David Taylor
2019-01-25 14:19:01 +00:00
committed by GitHub
parent 2d6aa2aea2
commit a48731e359
16 changed files with 261 additions and 149 deletions

View File

@ -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