mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:11:08 +08:00
FIX: Set class on color scheme links in bootstrap (#13594)
Exposes to Ember CLI environment the feature provided in the production env by `lib/stylesheet/manager.rb:295`. Fixes development env compatibility with discourse-color-scheme-toggle.
This commit is contained in:
@ -17,8 +17,10 @@ class BootstrapController < ApplicationController
|
||||
end
|
||||
|
||||
@stylesheets = []
|
||||
add_scheme(scheme_id, 'all')
|
||||
add_scheme(dark_scheme_id, '(prefers-color-scheme: dark)')
|
||||
|
||||
add_scheme(scheme_id, "all", "light-scheme")
|
||||
add_scheme(dark_scheme_id, "(prefers-color-scheme: dark)", "dark-scheme")
|
||||
|
||||
if rtl?
|
||||
add_style(mobile_view? ? :mobile_rtl : :desktop_rtl)
|
||||
else
|
||||
@ -73,11 +75,11 @@ class BootstrapController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
def add_scheme(scheme_id, media)
|
||||
def add_scheme(scheme_id, media, css_class)
|
||||
return if scheme_id.to_i == -1
|
||||
|
||||
if style = Stylesheet::Manager.new(theme_id: theme_id).color_scheme_stylesheet_details(scheme_id, media)
|
||||
@stylesheets << { href: style[:new_href], media: media }
|
||||
@stylesheets << { href: style[:new_href], media: media, class: css_class }
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user