2018-03-05 08:04:23 +08:00
|
|
|
class ThemeSettingsSerializer < ApplicationSerializer
|
2018-08-04 04:41:37 +08:00
|
|
|
attributes :setting, :type, :default, :value, :description, :valid_values,
|
2019-02-05 22:14:53 +08:00
|
|
|
:list_type, :textarea
|
2018-03-05 08:04:23 +08:00
|
|
|
|
|
|
|
def setting
|
|
|
|
object.name
|
|
|
|
end
|
|
|
|
|
|
|
|
def type
|
|
|
|
object.type_name
|
|
|
|
end
|
|
|
|
|
|
|
|
def default
|
|
|
|
object.default
|
|
|
|
end
|
|
|
|
|
|
|
|
def value
|
|
|
|
object.value
|
|
|
|
end
|
|
|
|
|
|
|
|
def description
|
|
|
|
object.description
|
|
|
|
end
|
|
|
|
|
|
|
|
def valid_values
|
|
|
|
object.choices
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_valid_values?
|
|
|
|
object.type == ThemeSetting.types[:enum]
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_description?
|
|
|
|
object.description.present?
|
|
|
|
end
|
2018-08-04 04:41:37 +08:00
|
|
|
|
|
|
|
def list_type
|
|
|
|
object.list_type
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_list_type?
|
|
|
|
object.type == ThemeSetting.types[:list]
|
|
|
|
end
|
2019-02-05 22:14:53 +08:00
|
|
|
|
|
|
|
def textarea
|
|
|
|
object.textarea
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_textarea?
|
|
|
|
object.type == ThemeSetting.types[:string]
|
|
|
|
end
|
|
|
|
|
2018-03-05 08:04:23 +08:00
|
|
|
end
|