FEATURE: Theme settings (2) (#5611)

Allows theme authors to specify custom theme settings for the theme. 

Centralizes the theme/site settings into a single construct
This commit is contained in:
OsamaSayegh
2018-03-05 03:04:23 +03:00
committed by Sam
parent 322618fc34
commit 282f53f0cd
42 changed files with 1202 additions and 217 deletions

View File

@ -76,6 +76,8 @@ class RemoteTheme < ActiveRecord::Base
end
Theme.targets.keys.each do |target|
next if target == :settings
ALLOWED_FIELDS.each do |field|
lookup =
if field == "scss"
@ -91,6 +93,9 @@ class RemoteTheme < ActiveRecord::Base
end
end
settings_yaml = importer["settings.yaml"] || importer["settings.yml"]
theme.set_field(target: :settings, name: "yaml", value: settings_yaml)
self.license_url ||= theme_info["license_url"]
self.about_url ||= theme_info["about_url"]
self.remote_updated_at = Time.zone.now