mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-14 21:24:54 +08:00
21 lines
507 B
Ruby
21 lines
507 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
module Api
|
||
|
module V1
|
||
|
class StepOrderableElementSerializer < ActiveModel::Serializer
|
||
|
attributes :position, :element
|
||
|
|
||
|
def element
|
||
|
case object.orderable_type
|
||
|
when 'Checklist'
|
||
|
ChecklistSerializer.new(object.orderable).as_json
|
||
|
when 'StepTable'
|
||
|
TableSerializer.new(object.orderable.table).as_json
|
||
|
when 'StepText'
|
||
|
StepTextSerializer.new(object.orderable).as_json
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|