2019-05-02 17:17:27 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2014-03-05 06:52:20 -06:00
|
|
|
class BadgeSerializer < ApplicationSerializer
|
2023-01-09 06:20:10 -06:00
|
|
|
attributes :id,
|
|
|
|
:name,
|
|
|
|
:description,
|
|
|
|
:grant_count,
|
|
|
|
:allow_title,
|
|
|
|
:multiple_grant,
|
|
|
|
:icon,
|
|
|
|
:image_url,
|
|
|
|
:listable,
|
|
|
|
:enabled,
|
|
|
|
:badge_grouping_id,
|
|
|
|
:system,
|
|
|
|
:long_description,
|
|
|
|
:slug,
|
|
|
|
:has_badge,
|
|
|
|
:manually_grantable?
|
2015-02-27 00:19:18 -06:00
|
|
|
|
2014-03-05 06:52:20 -06:00
|
|
|
has_one :badge_type
|
2014-07-24 03:28:09 -05:00
|
|
|
|
2017-10-30 00:21:05 -05:00
|
|
|
def include_has_badge?
|
|
|
|
object.has_badge
|
|
|
|
end
|
|
|
|
|
|
|
|
def has_badge
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2014-07-24 03:28:09 -05:00
|
|
|
def system
|
|
|
|
object.system?
|
|
|
|
end
|
2015-02-27 00:19:18 -06:00
|
|
|
|
|
|
|
def include_long_description?
|
|
|
|
options[:include_long_description]
|
|
|
|
end
|
2016-03-28 02:38:38 -05:00
|
|
|
|
|
|
|
def name
|
|
|
|
object.display_name
|
|
|
|
end
|
2014-03-05 06:52:20 -06:00
|
|
|
end
|