mirror of
https://github.com/discourse/discourse.git
synced 2024-12-16 05:53:47 +08:00
282f53f0cd
Allows theme authors to specify custom theme settings for the theme. Centralizes the theme/site settings into a single construct
36 lines
525 B
Ruby
36 lines
525 B
Ruby
class ThemeSettingsSerializer < ApplicationSerializer
|
|
attributes :setting, :type, :default, :value, :description, :valid_values
|
|
|
|
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
|
|
end
|