From 94a9bd066e7b40626c68e240bb7fcfeb2f5683fa Mon Sep 17 00:00:00 2001 From: surtic86 Date: Thu, 15 Oct 2026 09:17:23 +0200 Subject: [PATCH] feat: validate and store the size choice in redmine_tonalmine (T6) Co-Authored-By: Claude Opus 5.5 --- redmine_tonalmine/lib/redmine_tonalmine/appearance.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/redmine_tonalmine/lib/redmine_tonalmine/appearance.rb b/redmine_tonalmine/lib/redmine_tonalmine/appearance.rb index c3071a6..c60a3f5 100644 --- a/redmine_tonalmine/lib/redmine_tonalmine/appearance.rb +++ b/redmine_tonalmine/lib/redmine_tonalmine/appearance.rb @@ -1,12 +1,13 @@ module RedmineTonalmine - # Validates appearance hashes ({mode, contrast, palette, seed, css}) coming from users and from + # Validates appearance hashes ({mode, contrast, size, palette, seed, css}) coming from users and from # the Display settings form. Any part may be missing: it then falls back to the default. module Appearance MODES = %w[auto light dark].freeze CONTRASTS = %w[standard medium high].freeze + SIZES = %w[compact normal large].freeze # Ids must match PALETTES in tonalmine/javascripts/theme.js (tools/palettes checks this). PALETTES = %w[purple blue green orange].freeze - KEYS = %w[mode contrast palette seed css].freeze + KEYS = %w[mode contrast size palette seed css].freeze MAX_CSS = 32.kilobytes module_function @@ -21,6 +22,7 @@ module RedmineTonalmine end errors << 'invalid mode' if prefs['mode'] && !MODES.include?(prefs['mode']) errors << 'invalid contrast' if prefs['contrast'] && !CONTRASTS.include?(prefs['contrast']) + errors << 'invalid size' if prefs['size'] && !SIZES.include?(prefs['size']) errors.concat(custom_errors(prefs)) errors end @@ -30,6 +32,7 @@ module RedmineTonalmine prefs = normalize(hash) prefs.delete('mode') unless MODES.include?(prefs['mode']) prefs.delete('contrast') unless CONTRASTS.include?(prefs['contrast']) + prefs.delete('size') unless SIZES.include?(prefs['size']) prefs = prefs.except('palette', 'seed', 'css') if custom_errors(prefs).any? prefs.compact end