feat: redmine_tonalmine plugin for default and per-account appearance

Admins set the default mode, contrast and color on Settings > Display,
shown as three labelled form rows below the Theme select. Logged-in
users' choices are saved on their account and override only the parts
they changed; anonymous visitors get the default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andreas Reinhold / reini
2026-10-05 14:12:44 +02:00
co-authored by Claude Opus 5.5
parent 77040e24a8
commit 20b7269df2
11 changed files with 482 additions and 40 deletions
@@ -0,0 +1,17 @@
# Saves the current user's appearance (sent by theme.js). The body replaces the whole saved
# choice; an empty object resets the user to the default.
class TonalmineAppearanceController < ApplicationController
before_action :require_login
def update
prefs = params.to_unsafe_h.except('controller', 'action', 'tonalmine_appearance')
errors = RedmineTonalmine::Appearance.errors(prefs)
if errors.any?
render json: {errors: errors}, status: :unprocessable_content
else
User.current.pref[:tonalmine] = RedmineTonalmine::Appearance.clean(prefs)
User.current.pref.save
head :no_content
end
end
end