课堂权限调整、作业和毕设的私有参数调整

dev_course
cxt 6 years ago
parent 9586dee9cb
commit a1aa51353c

@ -274,7 +274,7 @@ class CoursesController < ApplicationController
end
end
@is_admin = current_user.creator_of_course? @course
@is_admin = @user_course_identity < Course::PROFESSOR
@applications= CourseMessage.unhandled_join_course_requests_by_course(@course)
@ -897,8 +897,8 @@ class CoursesController < ApplicationController
def top_banner
@user = current_user
@is_teacher = @user.teacher_of_course?(@course)
@is_student = @course.course_members.where(user_id: @user.id, role: 4, is_active: 1).present?
@is_teacher = @user_course_identity < Course::STUDENT
@is_student = @user_course_identity == Course::STUDENT
@course.increment!(:visits)
end

@ -11,7 +11,7 @@ json.course_end @course.is_end
json.deadline course_end_date @course.end_date
json.educoder_teacher @user.is_teacher?
#json.is_student @is_student
json.is_admin @user.creator_of_course?(@course)
json.is_admin @user_course_identity < Course::PROFESSOR
json.is_public @course.is_public == 1
json.code_halt @course.invite_code_halt == 1
json.invite_code @course.invite_code_halt == 0 ? @course.generate_invite_code : ""
@ -20,7 +20,7 @@ json.switch_to_teacher switch_teacher_role(@is_student, @course, @user)
json.switch_to_assistant switch_assistant_role(@is_student, @course, @user)
#json.join_course !@user.member_of_course?(@course)
#json.copy_course !@user.member_of_course?(@course) && @user.is_teacher?
json.course_identity @user.course_identity(@course)
json.course_identity @user_course_identity
if @course.is_end == 0
json.days_remaining (@course.end_date.to_date - Time.now.to_date).to_i
end

@ -7,10 +7,10 @@ json.unpublished_count @all_count - @published_count
json.task_count @task_count
json.tasks @tasks.each do |task|
task_private = @identity > Course::STUDENT && !task.is_public
# task_private = @identity > Course::STUDENT && !task.is_public
json.task_id task.id
json.name task.name
json.private_icon task_private
json.private_icon !task.is_public
json.task_status task.status #6.12 -hs
json.status task_curr_status(task, @course)[:status]
json.status_time task_curr_status(task, @course)[:time]

@ -1,6 +1,6 @@
json.array! topics do |topic|
task_private = course_identity > Course::STUDENT && !topic.is_public
json.private_icon task_private
# task_private = course_identity > Course::STUDENT && !topic.is_public
json.private_icon !topic.is_public
json.(topic, :id, :name, :status)
json.author topic.teacher.full_name
json.user_topic_status topic.user_status(current_user)

@ -12,10 +12,10 @@ json.category_id @category.try(:id)
json.category_name @category.try(:name)
json.homeworks @homework_commons.each do |homework|
homework_private = (@user_course_identity > Course::STUDENT) && !homework.is_public
# homework_private = (@user_course_identity > Course::STUDENT) && !homework.is_public
json.homework_id homework.id
json.name homework.name
json.private_icon homework_private
json.private_icon !homework.is_public
json.status homework_curr_status(homework, @user_course_identity, @course, @member, @member&.teacher_course_groups)[:status]
json.status_time homework_curr_status(homework, @user_course_identity, @course, @member, @member&.teacher_course_groups)[:time]
json.time_status homework_curr_status(homework, @user_course_identity, @course, @member, @member&.teacher_course_groups)[:time_status]

Loading…
Cancel
Save