mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 00:37:06 +08:00
a3b47c1dd1
To use, add `textarea: true` to the theme settings.yml. For example: ``` my_setting: default: "some string" textarea: true ```
54 lines
803 B
Ruby
54 lines
803 B
Ruby
class ThemeSettingsSerializer < ApplicationSerializer
|
|
attributes :setting, :type, :default, :value, :description, :valid_values,
|
|
:list_type, :textarea
|
|
|
|
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
|
|
|
|
def list_type
|
|
object.list_type
|
|
end
|
|
|
|
def include_list_type?
|
|
object.type == ThemeSetting.types[:list]
|
|
end
|
|
|
|
def textarea
|
|
object.textarea
|
|
end
|
|
|
|
def include_textarea?
|
|
object.type == ThemeSetting.types[:string]
|
|
end
|
|
|
|
end
|