2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-08-22 02:39:21 +08:00
|
|
|
require_dependency 'enum_site_setting'
|
|
|
|
|
|
|
|
class AutoTrackDurationSiteSetting < EnumSiteSetting
|
|
|
|
|
|
|
|
def self.valid_value?(val)
|
2015-09-14 16:48:24 +08:00
|
|
|
val.to_i.to_s == val.to_s &&
|
2015-09-09 20:34:44 +08:00
|
|
|
values.any? { |v| v[:value] == val.to_i }
|
2015-08-22 02:39:21 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.values
|
|
|
|
@values ||= [
|
|
|
|
{ name: 'user.auto_track_options.never', value: -1 },
|
|
|
|
{ name: 'user.auto_track_options.immediately', value: 0 },
|
|
|
|
{ name: 'user.auto_track_options.after_30_seconds', value: 1000 * 30 },
|
|
|
|
{ name: 'user.auto_track_options.after_1_minute', value: 1000 * 60 },
|
|
|
|
{ name: 'user.auto_track_options.after_2_minutes', value: 1000 * 60 * 2 },
|
|
|
|
{ name: 'user.auto_track_options.after_3_minutes', value: 1000 * 60 * 3 },
|
|
|
|
{ name: 'user.auto_track_options.after_4_minutes', value: 1000 * 60 * 4 },
|
|
|
|
{ name: 'user.auto_track_options.after_5_minutes', value: 1000 * 60 * 5 },
|
|
|
|
{ name: 'user.auto_track_options.after_10_minutes', value: 1000 * 60 * 10 },
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.translate_names?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|