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