2024-02-07 23:59:52 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ThemeSettingsManager::Objects < ThemeSettingsManager
|
|
|
|
def value
|
|
|
|
has_record? ? db_record.json_value : default.map!(&:deep_stringify_keys)
|
|
|
|
end
|
|
|
|
|
|
|
|
def value=(objects)
|
2024-03-10 20:42:12 -04:00
|
|
|
objects = JSON.parse(objects) if objects.is_a?(::String)
|
2024-02-27 21:33:22 -05:00
|
|
|
ensure_is_valid_value!(objects)
|
2024-03-07 03:38:11 -05:00
|
|
|
record = has_record? ? update_record!(json_value: objects) : create_record!(json_value: objects)
|
2024-02-07 23:59:52 -05:00
|
|
|
theme.reload
|
|
|
|
record.json_value
|
|
|
|
end
|
2024-03-05 19:24:29 -05:00
|
|
|
|
|
|
|
def schema
|
|
|
|
@opts[:schema]
|
|
|
|
end
|
2024-02-07 23:59:52 -05:00
|
|
|
end
|