forked from Trustie/forgeplus
14 lines
789 B
Ruby
14 lines
789 B
Ruby
json.total_count @communicates.total_count
|
|
json.communicates do
|
|
json.array! @communicates.each do |communicate|
|
|
json.(communicate, :id, :title, :content, :fake_id)
|
|
json.tag communicate.tag_field.present? && communicate.tag_field.include?(',') ? communicate.tag_field.split(",") : communicate.tag_field
|
|
json.created_time format_time(Memo.find_by(id: communicate.fake_id)&.published_at)
|
|
json.viewed_count Memo.find_by(id: communicate.fake_id)&.viewed_count
|
|
json.watched current_user.watched?(communicate)
|
|
json.enroll_field communicate.enroll_field.to_s.split(",")
|
|
json.enroll_info current_user.watched?(communicate) ? communicate.watched_ext_info(current_user.id) : []
|
|
json.url communicate.url_or_uuid
|
|
json.has_vote communicate.vote.present?
|
|
end
|
|
end |