diff --git a/app/helpers/subjects_helper.rb b/app/helpers/subjects_helper.rb index 9bae4a84..4d55b02a 100644 --- a/app/helpers/subjects_helper.rb +++ b/app/helpers/subjects_helper.rb @@ -7,6 +7,7 @@ module SubjectsHelper # 实训路径详情列表,右侧状态显示栏 def shixun_show_in_subject subject_status, shixun_status + content = "" content = if subject_status < 2 case shixun_status when 0, 1 diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index 2fb96d8b..fb1e901e 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -91,22 +91,19 @@ document.getElementById('nHeader').style.left=sl+'px'; } $(function () { - <% if params[:action] == "index" %> var $header = $("#header-nav").children("li"); - <% case params[:controller] %> - <% when "welcome" %> + <% if params[:controller] == "welcome" %> $("#header-nav").children("li").eq(0).addClass("active"); - <% when "shixuns" %> + <% elsif subjects_controller.include?(params[:controller]) %> $("#header-nav").children("li").eq(1).addClass("active"); - <% when "subjects" %> + <% elsif course_controller.include?(params[:controller]) %> $("#header-nav").children("li").eq(2).addClass("active"); - <% when "courses" %> + <% elsif shixuns_controller.include?(params[:controller]) %> $header.length == 7 ? $header.eq(2).addClass("active") : $header.eq(3).addClass("active"); - <% when "competitions" %> + <% elsif params[:controller] == "competitions" %> $header.length == 7 ? $header.eq(5).addClass("active") : $header.eq(4).addClass("active"); - <% when "forums" %> + <% elsif params[:controller] == "forums" %> $header.length == 7 ? $header.eq(6).addClass("active") : $header.eq(5).addClass("active"); <% end %> - <% end %> }) \ No newline at end of file