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

dev_shixuns
cxt 6 years ago
parent 213dc6a0af
commit cb4b71e5cd

@ -33,6 +33,28 @@ module ApplicationHelper
extend Forwardable extend Forwardable
def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter 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 def exercise_bank_json_data exercises
exercises.map do |exercise| exercises.map do |exercise|
exercise_path = exercise_bank_path(exercise) exercise_path = exercise_bank_path(exercise)

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

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

@ -2,10 +2,10 @@
<%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %> <%= link_to image_tag("/images/educoder/headNavLogo.png", alt:"高校智能化教学与实训平台", class:"logoimg"), home_path %>
<div class="head-nav pr"> <div class="head-nav pr">
<ul id="header-nav"> <ul id="header-nav">
<li class="<%= params[:action] == "index" && params[:controller] == "subjects" ? " active" : "" %>"><%= link_to "实训课程", subjects_path %></li> <li class="<%= subjects_controller.include?(params[:controller]) ? " active" : "" %>"><%= link_to "实训课程", subjects_path %></li>
<li class="<%= params[:action] == "index" && params[:controller] == "courses" ? " active" : "" %>"><%= link_to "翻转课堂", courses_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") %> <% careers = Career.published.order("created_at asc") %>
<% if careers.present? %> <% if careers.present? %>
@ -18,10 +18,10 @@
</ul> </ul>
</li> </li>
<% end %> <% end %>
<li class="<%= params[:action] == "index" && params[:controller] == "competitions" ? " active" : "" %>"><%= link_to "竞赛", competitions_path %></li> <li class="<%= 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] == "forums" ? " active" : "" %>"><%= link_to "问答", forums_path %></li>
<% if User.current.ec_school.present? %> <% 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) %> <%= link_to "认证", department_ecs_path(:school_id => User.current.ec_school) %>
</li> </li>
<% end %> <% end %>

Loading…
Cancel
Save