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

@ -350,11 +350,11 @@ module ApplicationHelper
end
end
def theme_id
def theme_ids
if customization_disabled?
nil
else
request.env[:resolved_theme_id]
request.env[:resolved_theme_ids]
end
end
@ -378,17 +378,17 @@ module ApplicationHelper
end
def theme_lookup(name)
lookup = Theme.lookup_field(theme_id, mobile_view? ? :mobile : :desktop, name)
lookup = Theme.lookup_field(theme_ids, mobile_view? ? :mobile : :desktop, name)
lookup.html_safe if lookup
end
def discourse_stylesheet_link_tag(name, opts = {})
if opts.key?(:theme_id)
id = opts[:theme_id] unless customization_disabled?
if opts.key?(:theme_ids)
ids = opts[:theme_ids] unless customization_disabled?
else
id = theme_id
ids = theme_ids
end
Stylesheet::Manager.stylesheet_link_tag(name, 'all', id)
Stylesheet::Manager.stylesheet_link_tag(name, 'all', ids)
end
end