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/memos/index.json.jbuilder

38 lines
1.0 KiB

##
# memo_list: 帖子列表
# memo_count: 帖子总数
# hot_memos: 热门帖子
# hot_tags: 热门标签
# recommend_shixuns: 推荐实训
# current_user: 当前用户信息
# tidding_count: 消息数
# #
json.memo_list @memos do |memo|
json.(memo, :id, :subject, :sticky,
:updated_at, :language, :reward,
:viewed_count, :forum_id)
json.praise_count memo.praise_treads.select{|pt| pt.praise_or_tread == 1}.count
json.replies_count memo.all_replies_count
json.tag memo.tag_repertoires.map(&:name)
json.user_name memo.author.full_name
json.login memo.author.login
json.image_url url_to_avatar(memo.author)
end
json.memo_count @memos_count
json.hot_memos do
json.array! @hot_memos do |hm|
json.(hm, :id, :subject, :language, :forum_id)
json.replies_count hm.all_replies_count
# json.praise_count hm.praise_tread.praise_count
json.tag hm.tag_repertoires.map(&:name)
end
end
json.hot_tags @tags_info.map{|o| o.attributes.dup.except("cnt", "id")}
json.recommend_shixuns @recommend_shixuns