]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/application_controller.rb
Add auto/manual color scheme stylesheets depending on user preferences
[rails.git] / app / controllers / application_controller.rb
index 7ce804ced01af000ada0560ee4f27f99046618ac..56d9a6763e0a4c3d3b59378bdcddd40d46f4dac0 100644 (file)
@@ -281,7 +281,15 @@ class ApplicationController < ActionController::Base
     end
   end
 
     end
   end
 
-  helper_method :preferred_editor
+  def preferred_site_color_scheme
+    if current_user
+      current_user.preferences.find_by(:k => "site.color_scheme")&.v || "auto"
+    else
+      "auto"
+    end
+  end
+
+  helper_method :preferred_editor, :preferred_site_color_scheme
 
   def update_totp
     if Settings.key?(:totp_key)
 
   def update_totp
     if Settings.key?(:totp_key)