Add dedicated user preferences for theme mode & contrast (#37288)
This commit is contained in:
1 parent
0231b6d350
commit
a0ce77673c
8 files changed
+71
-1
No files matched your search
@@ -18,6 +18,8 @@ class ApplicationController < ActionController::Base
|
||||
helper_method :current_account
|
||||
helper_method :current_session
|
||||
helper_method :current_theme
|
||||
helper_method :color_scheme
|
||||
helper_method :contrast
|
||||
helper_method :single_user_mode?
|
||||
helper_method :use_seamless_external_login?
|
||||
helper_method :sso_account_settings
|
||||
@@ -177,6 +179,25 @@ class ApplicationController < ActionController::Base
|
||||
current_user.setting_theme
|
||||
end
|
||||
|
||||
def color_scheme
|
||||
current = current_user&.setting_color_scheme
|
||||
return current if current && current != 'auto'
|
||||
|
||||
return 'dark' if current_theme.include?('default') || current_theme.include?('contrast')
|
||||
return 'light' if current_theme.include?('light')
|
||||
|
||||
'auto'
|
||||
end
|
||||
|
||||
def contrast
|
||||
current = current_user&.setting_contrast
|
||||
return current if current && current != 'auto'
|
||||
|
||||
return 'high' if current_theme.include?('contrast')
|
||||
|
||||
'auto'
|
||||
end
|
||||
|
||||
def respond_with_error(code)
|
||||
respond_to do |format|
|
||||
format.any { render "errors/#{code}", layout: 'error', status: code, formats: [:html] }
|
||||
|
||||
Reference in new issue
Block a user