dev_jupyter
daiao 5 years ago
parent bdbf6f68f7
commit 6b03a56c23

@ -1,12 +1,23 @@
module SubjectsHelper
# 实训路径的发布状态
def publish_status subject, is_manager, user
def publish_status subject, is_manager
status = -1
if is_manager
status = 0 if subject.status == 0
status = 1 if subject.status == 1
status = 2 if subject.status == 2 && user.admin?
status = 2 if subject.status == 2
end
status
end
# 实训路径的公开状态
def public_status subject, is_manager, user
status = -1
if is_manager
status = 0 if subject.public == 0
status = 1 if subject.public == 1
status = 2 if subject.public == 2 && user.admin?
end
status
end

@ -6,7 +6,8 @@ json.subject_score @subject.all_score
json.member_count @subject.member_count
json.allow_delete (@subject.status != 2 && @is_creator) || @user.admin?
json.publish_status publish_status(@subject, @is_manager, @user)
json.publish_status publish_status(@subject, @is_manager)
json.public_status public_status(@subject, @is_manager, @user)
json.allow_statistics @is_manager
json.allow_send @user.logged?
json.allow_visit @subject.status > 1 || @is_manager

Loading…
Cancel
Save