进入子模块需要选中对应的导航

dev_shixuns
cxt 6 years ago
parent 213dc6a0af
commit cb4b71e5cd

@ -33,6 +33,28 @@ module ApplicationHelper
extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter
# 课堂相关controller
def course_controller
["courses", "homework_common", "student_work", "exercise", "poll", "boards", "messages", "graduation_topics", "graduation_tasks",
"graduation_works", "files"]
end
# 实训课程相关controller
def subjects_controller
["subjects", "stages"]
end
# 实训路径相关controller
def shixuns_controller
["shixuns", "challenges", "myshixuns", "games"]
end
# 工程认证相关controller
def ecs_controller
["ecs", "ec_courses", "ec_course_evaluations", "ec_course_supports", "ec_course_targets", "ec_graduation_requirements",
"ec_major_schools", "ec_majors", "ec_years"]
end
def exercise_bank_json_data exercises
exercises.map do |exercise|
exercise_path = exercise_bank_path(exercise)

@ -188,9 +188,9 @@ class HomeworkCommon < ActiveRecord::Base
# end
end
def is_program_homework?
self.homework_type == 2 && self.homework_detail_programing
end
# def is_program_homework?
# self.homework_type == 2 && self.homework_detail_programing
# end
def is_group_homework?
self.homework_type == 3 && self.homework_detail_group
@ -225,6 +225,6 @@ class HomeworkCommon < ActiveRecord::Base
end
end
delegate :language_name, :language, :to => :homework_detail_programing
# delegate :language_name, :language, :to => :homework_detail_programing
end

@ -24,7 +24,7 @@ class StudentWork < ActiveRecord::Base
scope :all_commit, lambda{where("work_status != 0")}
before_destroy :delete_praise
before_save :set_program_score, :set_src
before_save :set_program_score
after_save :update_avg_sum_score
# after_create :act_as_message
@ -34,25 +34,26 @@ class StudentWork < ActiveRecord::Base
PraiseTread.where("praise_tread_object_id = #{self.id} AND praise_tread_object_type = 'StudentWork'").destroy_all
end
def last_test
student_work_tests.order('id desc').first
end
# def last_test
# student_work_tests.order('id desc').first
# end
private
def set_program_score
if self.homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
#根据最后一次测试计算得分
unless last_test
self.system_score = 0
else
self.system_score = last_test.test_score self.homework_common.homework_tests.size
end
end
# if self.homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
# #根据最后一次测试计算得分
# unless last_test
# self.system_score = 0
# else
# self.system_score = last_test.test_score self.homework_common.homework_tests.size
# end
# end
set_final_score self.homework_common,self
end
def set_src
self.description = last_test.src if last_test
end
# def set_src
# self.description = last_test.src if last_test
# end
#成绩计算
def set_final_score homework,student_work
@ -217,8 +218,8 @@ class StudentWork < ActiveRecord::Base
# status == 0 : delay
def act_as_message
if self.work_status != 0 && self.created_at > self.homework_common.end_time
self.course_messages << CourseMessage.new(:user_id => self.user_id, :course_id => self.homework_common.course_id, :viewed => false, :status => false)
end
# if self.work_status != 0 && self.created_at > self.homework_common.end_time
# self.course_messages << CourseMessage.new(:user_id => self.user_id, :course_id => self.homework_common.course_id, :viewed => false, :status => false)
# end
end
end

@ -2,10 +2,10 @@
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %>
<div class="head-nav pr">
<ul id="header-nav">
<li class="<%= params[:action] == "index" && params[:controller] == "subjects" ? " active" : "" %>"><%= link_to "实训课程", subjects_path %></li>
<li class="<%= params[:action] == "index" && params[:controller] == "courses" ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实训课程", subjects_path %></li>
<li class="<%= course_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "翻转课堂", courses_path %></li>
<!-- 精选实训 -->
<li class="pr<%= params[:action] == "index" && params[:controller] == "shixuns" ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
<li class="pr<%= shixuns_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "开发社区", shixuns_path %><img src="/images/educoder/hot-h.png" class="nav-img" /></li>
<% careers = Career.published.order("created_at asc") %>
<% if careers.present? %>
@ -18,10 +18,10 @@
</ul>
</li>
<% end %>
<li class="<%= params[:action] == "index" && params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li>
<li class="<%= params[:action] == "index" && params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<li class="<%= params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li>
<li class="<%= params[:controller] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<% if User.current.ec_school.present? %>
<li class="<%= params[:controller] == "ecs" ? " active" : "" %>" id="ec_banner">
<li class="<%= ecs_controller.include?(params[:controller]) ? " active" : "" %>" id="ec_banner">
<%= link_to "认证", department_ecs_path(:school_id => User.current.ec_school) %>
</li>
<% end %>

Loading…
Cancel
Save