discourse/app/models/base_font_setting.rb
Bianca Nenciu eb891778ff
DEV: Do not translate font names (#10723)
Use the names as provided by discourse-fonts and remove the
translated strings.

It also ensures that the selected font is present in case a font will
be removed in the future.
2020-09-23 12:00:07 +03:00

16 lines
321 B
Ruby

# frozen_string_literal: true
require "enum_site_setting"
class BaseFontSetting < EnumSiteSetting
def self.valid_value?(val)
values.any? { |v| v[:value].to_s == val.to_s }
end
def self.values
@values ||= DiscourseFonts.fonts.map do |font|
{ name: font[:name], value: font[:key] }
end
end
end