end
end
- def preferred_site_color_scheme
+ def preferred_color_scheme(subject)
if current_user
- current_user.preferences.find_by(:k => "site.color_scheme")&.v || "auto"
+ current_user.preferences.find_by(:k => "#{subject}.color_scheme")&.v || "auto"
else
"auto"
end
end
- helper_method :preferred_editor, :preferred_site_color_scheme
+ helper_method :preferred_editor, :preferred_color_scheme
def update_totp
if Settings.key?(:totp_key)
<%= javascript_include_tag "turbo", :type => "module" %>
<%= javascript_include_tag "application" %>
<%= javascript_include_tag "i18n/#{I18n.locale}" %>
- <% if preferred_site_color_scheme == "auto" %>
+ <% if preferred_color_scheme(:site) == "auto" %>
<%= stylesheet_link_tag "screen-auto-#{dir}", :media => "screen" %>
<% else %>
<%= stylesheet_link_tag "screen-manual-#{dir}", :media => "screen" %>
<!DOCTYPE html>
-<%= tag.html :lang => I18n.locale, :dir => dir, :data => { :bs_theme => (preferred_site_color_scheme if preferred_site_color_scheme != "auto") } do %>
+<%= tag.html :lang => I18n.locale,
+ :dir => dir,
+ :data => { :bs_theme => (preferred_color_scheme(:site) if preferred_color_scheme(:site) != "auto") } do %>
<%= render :partial => "layouts/head" %>
<body class="<%= body_class %>">
<%= render :partial => "layouts/header" %>
<%= label_tag "site_color_scheme", t("preferences.show.preferred_site_color_scheme"), :class => "form-label" %>
<%= select_tag "site_color_scheme",
options_for_select(%w[auto light dark].map { |scheme| [t("preferences.show.site_color_schemes.#{scheme}"), scheme] },
- preferred_site_color_scheme),
+ preferred_color_scheme(:site)),
:class => "form-select" %>
</div>
<dt class="col-sm-4"><%= t ".preferred_site_color_scheme" %></dt>
<dd class="col-sm-8">
- <%= t ".site_color_schemes.#{preferred_site_color_scheme}" %>
+ <%= t ".site_color_schemes.#{preferred_color_scheme(:site)}" %>
</dd>
</dl>