FEATURE: custom colors for default letter avatars (#7167)

This commit is contained in:
Maja Komel
2019-03-18 16:24:21 +01:00
committed by Régis Hanol
parent 22c75e1c04
commit 7e9afdace3
5 changed files with 50 additions and 2 deletions

View File

@ -0,0 +1,14 @@
class ColorListValidator
def initialize(opts = {})
@opts = opts
end
def valid_value?(value)
hex_regex = /\A\h{6}\z/
value.split("|").all? { |c| c =~ hex_regex }
end
def error_message
I18n.t('site_settings.errors.invalid_hex_value')
end
end