scinote-web/app/serializers/table_serializer.rb
artoscinote 23872f519b
Implement step element sorting modal [SCI-6849] (#4124)
* Implement step element sorting modal [SCI-6849]

* Implement step reordering modal [SCI-6850]

* Refactor reorderable items a bit [SCI-6850]
2022-05-30 13:45:51 +02:00

27 lines
468 B
Ruby

# frozen_string_literal: true
class TableSerializer < ActiveModel::Serializer
include Rails.application.routes.url_helpers
attributes :name, :contents, :urls, :icon
def contents
object.contents_utf_8
end
def icon
'fa-table'
end
def urls
return if object.destroyed?
object.reload unless object.step
{
delete_url: step_table_path(object.step, object),
update_url: step_table_path(object.step, object)
}
end
end