FEATURE: backend support for user-selectable components

* FEATURE: backend support for user-selectable components

* fix problems with previewing default theme

* rename preview_key => preview_theme_id

* omit default theme from child themes dropdown and try a different fix

* cache & freeze stylesheets arrays
This commit is contained in:
Osama Sayegh
2018-08-08 07:46:34 +03:00
committed by Sam
parent aafff740d2
commit 0b7ed8ffaf
53 changed files with 737 additions and 355 deletions

View File

@ -8,7 +8,10 @@ module Stylesheet
end
def self.theme_id
@theme_id || SiteSetting.default_theme_id
if @theme_id.blank? && SiteSetting.default_theme_id != -1
@theme_id = SiteSetting.default_theme_id
end
@theme_id
end
def self.watch(paths = nil)
@ -76,12 +79,8 @@ module Stylesheet
Stylesheet::Manager.cache.clear
message = ["desktop", "mobile", "admin"].map do |name|
{
target: name,
new_href: Stylesheet::Manager.stylesheet_href(name.to_sym),
theme_id: Stylesheet::Watcher.theme_id
}
end
Stylesheet::Manager.stylesheet_data(name.to_sym, Stylesheet::Watcher.theme_id)
end.flatten
MessageBus.publish '/file-change', message
end