mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 09:57:25 +08:00
UX: Apply changes live when editing currently active palette (#31874)
When editing a color palette via the new page introduced in https://github.com/discourse/discourse/pull/31742, it should apply the color changes for the admin making the change automatically upon save. Internal topic: t/148628/12.
This commit is contained in:
@ -341,7 +341,12 @@ class Stylesheet::Manager
|
||||
end
|
||||
end
|
||||
|
||||
def color_scheme_stylesheet_details(color_scheme_id = nil, dark: false, fallback_to_base: true)
|
||||
def color_scheme_stylesheet_details(
|
||||
color_scheme_id = nil,
|
||||
dark: false,
|
||||
fallback_to_base: true,
|
||||
include_dark_scheme: false
|
||||
)
|
||||
theme_id = @theme_id || SiteSetting.default_theme_id
|
||||
|
||||
color_scheme = ColorScheme.find_by(id: color_scheme_id)
|
||||
@ -373,6 +378,18 @@ class Stylesheet::Manager
|
||||
|
||||
href = builder.stylesheet_absolute_url
|
||||
stylesheet[:new_href] = href
|
||||
|
||||
if include_dark_scheme
|
||||
dark_href =
|
||||
self.color_scheme_stylesheet_link_tag_href(
|
||||
color_scheme_id,
|
||||
dark: true,
|
||||
fallback_to_base: false,
|
||||
)
|
||||
|
||||
stylesheet[:new_dark_href] = dark_href if dark_href
|
||||
end
|
||||
|
||||
stylesheet.freeze
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user