mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-02 09:54:37 +08:00
* Implement step element sorting modal [SCI-6849] * Implement step reordering modal [SCI-6850] * Refactor reorderable items a bit [SCI-6850]
23 lines
624 B
Ruby
23 lines
624 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ChecklistSerializer < ActiveModel::Serializer
|
|
include Rails.application.routes.url_helpers
|
|
|
|
attributes :id, :name, :urls, :icon
|
|
has_many :checklist_items, serializer: ChecklistItemSerializer
|
|
|
|
def icon
|
|
'fa-list-ul'
|
|
end
|
|
|
|
def urls
|
|
return {} if object.destroyed?
|
|
|
|
{
|
|
delete_url: step_checklist_path(object.step, object),
|
|
update_url: step_checklist_path(object.step, object),
|
|
reorder_url: reorder_step_checklist_checklist_items_path(object.step, object),
|
|
create_item_url: step_checklist_checklist_items_path(object.step, object)
|
|
}
|
|
end
|
|
end
|