2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-05-03 23:31:16 +08:00
|
|
|
# we can not guess what to do if customization already started, so skip it
|
|
|
|
if !Theme.exists?
|
2020-10-14 22:18:02 +08:00
|
|
|
STDERR.puts "> Seeding theme and color schemes"
|
2017-05-03 23:31:16 +08:00
|
|
|
|
2020-10-16 02:05:48 +08:00
|
|
|
color_schemes = [
|
|
|
|
{ name: I18n.t("color_schemes.dark"), base_scheme_id: "Dark" },
|
|
|
|
{ name: I18n.t("color_schemes.wcag"), base_scheme_id: "WCAG" },
|
|
|
|
{ name: I18n.t("color_schemes.wcag_dark"), base_scheme_id: "WCAG Dark" }
|
|
|
|
]
|
|
|
|
|
|
|
|
color_schemes.each do |cs|
|
|
|
|
scheme = ColorScheme.find_by(base_scheme_id: cs[:base_scheme_id])
|
|
|
|
scheme ||= ColorScheme.create_from_base(name: cs[:name], via_wizard: true, base_scheme_id: cs[:base_scheme_id], user_selectable: true)
|
|
|
|
end
|
2017-05-03 23:31:16 +08:00
|
|
|
|
|
|
|
name = I18n.t('color_schemes.default_theme_name')
|
2020-10-14 22:18:02 +08:00
|
|
|
default_theme = Theme.create!(name: name, user_id: -1)
|
2017-05-03 23:31:16 +08:00
|
|
|
default_theme.set_default!
|
|
|
|
end
|