Merge branches 'dev_aliyun' and 'dev_cxt' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_cxt

yslnewtiku
杨树明 5 years ago
commit 0b18755cf3

@ -165,9 +165,10 @@ class ShixunsController < ApplicationController
def show_right
owner = @shixun.owner
#@fans_count = owner.fan_count
#@followed_count = owner.follow_count
@user_own_shixuns = owner.shixuns.published.count
@user_tags = @shixun.user_tags_name(current_user)
@shixun_tags = @shixun.challenge_tags_name
@myshixun = @shixun.myshixuns.find_by(user_id: current_user.id)
end
# 排行榜
@ -345,7 +346,11 @@ class ShixunsController < ApplicationController
#合作者
def collaborators
@user = current_user
@members = @shixun.shixun_members.includes(:user)
## 分页参数
page = params[:page] || 1
limit = params[:limit] || 10
@member_count = @shixun.shixun_members.count
@members = @shixun.shixun_members.includes(:user).page(page).per(limit)
end
def fork_list

@ -13,11 +13,17 @@ json.recommands do
json.partial! 'shap_shixun', locals: { shixuns: shixun.relation_path.size > 0 ? recommend_shixun(shixun) : [] }
end
if shixun.status > 1
json.complete_count @myshixun&.passed_count
json.challenge_count @shixun.challenges_count
end
# 技能标签
user_tags = shixun.user_tags_name(User.current)
json.tags do
json.array! shixun.challenge_tags_name do |tag|
json.array! @shixun_tags do |tag|
json.tag_name tag
json.status user_tags.include?(tag)
json.status @user_tags.include?(tag)
end
end
json.tag_count @shixun_tags.size
json.user_tag_count @user_tags.size

@ -6,7 +6,8 @@
# ]
json.array! @members do |member|
json.member_count @member_count
json.members @members do |member|
json.user do
json.partial! 'users/user', locals: { user: member.user }
json.user_shixuns_count member.user.shixuns.published.count

@ -1,6 +1,6 @@
json.partial! 'shixuns/right', locals: { shixun: @shixun }
json.follow follow?(@shixun.owner, User.current)
json.fans_count @fans_count
json.followed_count @followed_count
# json.follow follow?(@shixun.owner, User.current)
# json.fans_count @fans_count
# json.followed_count @followed_count
json.user_shixuns_count @user_own_shixuns

Loading…
Cancel
Save