From b9a72287d12da921877cd95826eb41f2c66c2cb9 Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 14 Mar 2019 16:39:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=AA=E7=99=BB=E5=BD=95=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E4=B8=8B=E7=9A=84=E5=AF=BC=E8=88=AA=E6=A0=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/subjects_helper.rb | 1 + app/views/layouts/_unlogin_header.html.erb | 15 ++++++--------- 2 files changed, 7 insertions(+), 9 deletions(-) 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