Sha256: bb798fa00953b1ead9b8faf209fd1ac6c0bfcd76b8dcf24161f6fbb78df06a34
Contents?: true
Size: 990 Bytes
Versions: 2
Compression:
Stored size: 990 Bytes
Contents
# frozen_string_literal: true module Decidim module Comments class CommentSerializer < Decidim::Exporters::Serializer include Decidim::ResourceHelper # Serializes a comment def serialize { id: resource.id, created_at: resource.created_at, body: resource.body, author: { id: resource.author.id, name: resource.author.name }, alignment: resource.alignment, depth: resource.depth, user_group: { id: resource.user_group.try(:id), name: resource.user_group.try(:name) }, commentable_id: resource.decidim_commentable_id, commentable_type: resource.decidim_commentable_type, root_commentable_url: root_commentable_url } end private def root_commentable_url @root_commentable_url ||= decidim_resource_url(resource.root_commentable) end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
decidim-comments-0.2.0 | lib/decidim/comments/comment_serializer.rb |
decidim-0.2.0 | decidim-comments/lib/decidim/comments/comment_serializer.rb |