2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-09-25 23:32:08 +08:00
|
|
|
class UserFieldSerializer < ApplicationSerializer
|
2014-10-09 02:38:18 +08:00
|
|
|
attributes :id,
|
|
|
|
:name,
|
|
|
|
:description,
|
|
|
|
:field_type,
|
|
|
|
:editable,
|
2015-01-30 06:38:39 +08:00
|
|
|
:required,
|
2015-07-29 00:29:40 +08:00
|
|
|
:show_on_profile,
|
2016-04-08 20:35:41 +08:00
|
|
|
:show_on_user_card,
|
2021-04-27 13:52:45 +08:00
|
|
|
:searchable,
|
2015-07-31 02:52:53 +08:00
|
|
|
:position,
|
2015-07-29 00:29:40 +08:00
|
|
|
:options
|
|
|
|
|
|
|
|
def options
|
|
|
|
object.user_field_options.pluck(:value)
|
|
|
|
end
|
|
|
|
|
|
|
|
def include_options?
|
|
|
|
options.present?
|
|
|
|
end
|
2014-09-25 23:32:08 +08:00
|
|
|
end
|