|
|
@ -55,32 +55,32 @@ module CoursesHelper
|
|
|
|
return nil if mod.blank? or course.blank?
|
|
|
|
return nil if mod.blank? or course.blank?
|
|
|
|
case mod.module_type
|
|
|
|
case mod.module_type
|
|
|
|
when "announcement"
|
|
|
|
when "announcement"
|
|
|
|
"/courses/#{course.id}/informs"
|
|
|
|
"/classrooms/#{course.id}/informs"
|
|
|
|
when "online_learning"
|
|
|
|
when "online_learning"
|
|
|
|
"/courses/#{course.id}/online_learning"
|
|
|
|
"/classrooms/#{course.id}/online_learning"
|
|
|
|
when "shixun_homework"
|
|
|
|
when "shixun_homework"
|
|
|
|
"/courses/#{course.id}/shixun_homeworks/#{mod.id}"
|
|
|
|
"/classrooms/#{course.id}/shixun_homeworks/#{mod.id}"
|
|
|
|
when "common_homework"
|
|
|
|
when "common_homework"
|
|
|
|
"/courses/#{course.id}/common_homeworks/#{mod.id}"
|
|
|
|
"/classrooms/#{course.id}/common_homeworks/#{mod.id}"
|
|
|
|
when "group_homework"
|
|
|
|
when "group_homework"
|
|
|
|
"/courses/#{course.id}/group_homeworks/#{mod.id}"
|
|
|
|
"/classrooms/#{course.id}/group_homeworks/#{mod.id}"
|
|
|
|
when "graduation"
|
|
|
|
when "graduation"
|
|
|
|
"/courses/#{course.id}/graduation_topics/#{mod.id}"
|
|
|
|
"/classrooms/#{course.id}/graduation_topics/#{mod.id}"
|
|
|
|
when "exercise"
|
|
|
|
when "exercise"
|
|
|
|
"/courses/#{course.id}/exercises/#{mod.id}"
|
|
|
|
"/classrooms/#{course.id}/exercises/#{mod.id}"
|
|
|
|
when "poll"
|
|
|
|
when "poll"
|
|
|
|
"/courses/#{course.id}/polls/#{mod.id}"
|
|
|
|
"/classrooms/#{course.id}/polls/#{mod.id}"
|
|
|
|
when "attachment"
|
|
|
|
when "attachment"
|
|
|
|
"/courses/#{course.id}/files/#{mod.id}"
|
|
|
|
"/classrooms/#{course.id}/files/#{mod.id}"
|
|
|
|
when "board"
|
|
|
|
when "board"
|
|
|
|
course_board = course.course_board
|
|
|
|
course_board = course.course_board
|
|
|
|
"/courses/#{course.id}/boards/#{course_board.id}"
|
|
|
|
"/classrooms/#{course.id}/boards/#{course_board.id}"
|
|
|
|
when "course_group"
|
|
|
|
when "course_group"
|
|
|
|
"/courses/#{course.id}/course_groups"
|
|
|
|
"/classrooms/#{course.id}/course_groups"
|
|
|
|
when "statistics"
|
|
|
|
when "statistics"
|
|
|
|
"/courses/#{course.id}/statistics"
|
|
|
|
"/classrooms/#{course.id}/statistics"
|
|
|
|
when "video"
|
|
|
|
when "video"
|
|
|
|
"/courses/#{course.id}/course_videos"
|
|
|
|
"/classrooms/#{course.id}/course_videos"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -88,17 +88,17 @@ module CoursesHelper
|
|
|
|
def category_url category, course
|
|
|
|
def category_url category, course
|
|
|
|
case category.category_type
|
|
|
|
case category.category_type
|
|
|
|
when "shixun_homework"
|
|
|
|
when "shixun_homework"
|
|
|
|
"/courses/#{course.id}/shixun_homework/#{category.id}"
|
|
|
|
"/classrooms/#{course.id}/shixun_homework/#{category.id}"
|
|
|
|
when "graduation"
|
|
|
|
when "graduation"
|
|
|
|
if category.name == "毕设选题"
|
|
|
|
if category.name == "毕设选题"
|
|
|
|
"/courses/#{course.id}/graduation_topics/#{category.course_module_id}"
|
|
|
|
"/classrooms/#{course.id}/graduation_topics/#{category.course_module_id}"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
"/courses/#{course.id}/graduation_tasks/#{category.course_module_id}"
|
|
|
|
"/classrooms/#{course.id}/graduation_tasks/#{category.course_module_id}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
when "attachment"
|
|
|
|
when "attachment"
|
|
|
|
"/courses/#{course.id}/file/#{category.id}"
|
|
|
|
"/classrooms/#{course.id}/file/#{category.id}"
|
|
|
|
when "video"
|
|
|
|
when "video"
|
|
|
|
"/courses/#{course.id}/course_video/#{category.id}"
|
|
|
|
"/classrooms/#{course.id}/course_video/#{category.id}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -147,7 +147,7 @@ module CoursesHelper
|
|
|
|
when "online_learning"
|
|
|
|
when "online_learning"
|
|
|
|
course.shixuns.count
|
|
|
|
course.shixuns.count
|
|
|
|
when "video"
|
|
|
|
when "video"
|
|
|
|
course.course_videos.count + course.live_links.count
|
|
|
|
course.videos_count + course.live_links.count
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
@ -296,11 +296,11 @@ module CoursesHelper
|
|
|
|
none_group_count = course.students.where(course_group_id: 0).size
|
|
|
|
none_group_count = course.students.where(course_group_id: 0).size
|
|
|
|
group_info << {category_id: 0, category_name: "未分班", position: course.course_groups.pluck(:position).max.to_i + 1,
|
|
|
|
group_info << {category_id: 0, category_name: "未分班", position: course.course_groups.pluck(:position).max.to_i + 1,
|
|
|
|
category_count: none_group_count, category_type: false,
|
|
|
|
category_count: none_group_count, category_type: false,
|
|
|
|
second_category_url: "/courses/#{@course.id}/course_groups/0"}
|
|
|
|
second_category_url: "/classrooms/#{@course.id}/course_groups/0"}
|
|
|
|
course.course_groups.each do |course_group|
|
|
|
|
course.course_groups.each do |course_group|
|
|
|
|
group_info << {category_id: course_group.id, category_name: course_group.name, position: course_group.position,
|
|
|
|
group_info << {category_id: course_group.id, category_name: course_group.name, position: course_group.position,
|
|
|
|
category_count: course_group.course_members_count, category_type: false,
|
|
|
|
category_count: course_group.course_members_count, category_type: false,
|
|
|
|
second_category_url: "/courses/#{@course.id}/course_groups/#{course_group.id}"}
|
|
|
|
second_category_url: "/classrooms/#{@course.id}/course_groups/#{course_group.id}"}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
group_info
|
|
|
|
group_info
|
|
|
|