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/discusses/_discuss.json.jbuilder

23 lines
723 B

6 years ago
json.author do
json.partial! 'users/user', user: discuss.user
end
json.id discuss.id
json.content discuss.content
6 years ago
json.time time_from_now(discuss.created_at)
json.position discuss.position
json.shixun_id discuss.dis_id
json.hidden discuss.hidden
json.manage current_user.manager_of_shixun?(container)
json.reward discuss.reward
#json.game_url discuss.game_url(container, current_user)
json.game_url "/tasks/#{discuss.identifier}" if @manger
6 years ago
# 主贴和回复有一些不同点
if discuss.parent_id
json.can_delete discuss.can_deleted?(current_user)
else
json.praise_count discuss.praises_count
json.user_praise discuss.praise_treads.select{|pt| pt.user_id == current_user.id}.length > 0
6 years ago
end