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.
28 lines
1.0 KiB
28 lines
1.0 KiB
json.id memo.id
|
|
json.content content_safe(memo.content)
|
|
json.time time_from_now(memo.created_at)
|
|
json.user_id memo.author_id
|
|
json.image_url url_to_avatar(memo.author)
|
|
json.username memo.author.full_name
|
|
json.reward memo.reward
|
|
json.hidden memo.hidden
|
|
json.permission @user.manager_of_memo?(memo)
|
|
json.praise_count memo.praise_treads.select{|pt| pt.praise_or_tread == 1}.count
|
|
json.user_praise memo.praise_treads.select{|pt| pt.praise_or_tread == 1 && pt.user_id == @user.id}.length > 0
|
|
json.user_login memo.author.login
|
|
json.admin @user.admin? || @user.business?
|
|
|
|
json.children do
|
|
json.array! memo.children_of_reply do |child|
|
|
json.id child.id
|
|
json.content content_safe(child.content)
|
|
json.time time_from_now(child.created_at)
|
|
json.image_url url_to_avatar(child.author)
|
|
json.username child.author.full_name
|
|
json.hidden child.hidden
|
|
json.permission @user.manager_of_memo?(memo)
|
|
json.user_login child.author.try(:login)
|
|
json.user_id child.author.try(:id)
|
|
end
|
|
end
|