You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/shixuns/discusses.json.jbuilder

40 lines
993 B

6 years ago
# [
# {
# user: User,
# follow: true, //是否已经关注
# time: '', //TODO 这里与前端协商是否要返回human格式
# round: 1, //关卡
# content: '', //留言内容
# replies:[ //跟帖
# {
# user: User,
# time: '',
# content: '' //留言内容
# }
# ]
# }
# ]
json.array! @children_list do |dis|
json.user do
json.partial! 'users/user', locals: { user: dis[:user] }
end
json.time dis[:time]
json.follow follow?(dis[:user], User.current)
json.round dis[:position] || 1
json.content dis[:content].html_safe
json.game_url dis[:game_url]
json.hidden dis[:hidden]
json.replies do
json.array! dis[:children] do |child|
json.user do
json.partial! 'users/user', locals: { user: child[:user] }
end
json.time child[:time]
json.content child[:content].html_safe
end
end
end