mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-03 16:50:30 +08:00
Allow picking Saturday,Sunday or Monday as first day of week. Keeps current default and adds extensive testing. --------- Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com> Co-authored-by: Martin Brennan <martin@discourse.org>
21 lines
515 B
Ruby
21 lines
515 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_dependency "enum_site_setting"
|
|
|
|
class CalendarFirstDayOfWeek < EnumSiteSetting
|
|
def self.valid_value?(val)
|
|
values.any? { |v| v[:value].to_s == val.to_s }
|
|
end
|
|
|
|
def self.values
|
|
@values ||= [
|
|
{ name: "user.notification_schedule.saturday", value: "saturday" },
|
|
{ name: "user.notification_schedule.sunday", value: "sunday" },
|
|
{ name: "user.notification_schedule.monday", value: "monday" },
|
|
]
|
|
end
|
|
|
|
def self.translate_names?
|
|
true
|
|
end
|
|
end
|