From 2a72f7aac849d69aca811f4c7484da1239d69a96 Mon Sep 17 00:00:00 2001 From: xianbo Date: Fri, 4 Apr 2014 15:24:42 +0800 Subject: [PATCH] evils fix --- ReadMe接手必读.txt | 16 ++++++++++++++++ app/controllers/welcome_controller.rb | 2 +- app/views/layouts/_base_header.html.erb | 14 ++------------ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/ReadMe接手必读.txt b/ReadMe接手必读.txt index d7c1aa00..5e85a999 100644 --- a/ReadMe接手必读.txt +++ b/ReadMe接手必读.txt @@ -9,3 +9,19 @@ app\models\setting.rb :165 ΪÁË¿ª·¢·½±ã£¬Ê¹Ö®¹¦ÄÜÔÚdevelopmentģʽÏÂʧЧ¡£ # => nyan ================================================================================ +#µ¼º½À¸Æ¥ÅäÓòÃûÏÔʾºÍ¸Ä±ä +app\helper\application_helper.rb +# rewrite navigation + +app\views\layouts\_base_header.html.erb +# reset navigation by domain name and url through regular match +================================================================================ +#Ê×Ò³¸ù¾ÝÓòÃûÆ¥Åä½øÈ벻ͬµÄÒ³Ãæ +app\controller\welcome_controller.rb + def entry_select_user + if request.original_url.match(/user\.trustie\.net/) + redirect_to(:controller => "users", :action => "index") + return 0 + end + end +================================================================================ \ No newline at end of file diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index 904920c5..1587cd61 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -126,7 +126,7 @@ class WelcomeController < ApplicationController end def entry_select_user - if request.original_url.match(/user\.trustie\.net/) + if request.original_url.match(/user\.trustie\.net$/) redirect_to(:controller => "users", :action => "index") return 0 end diff --git a/app/views/layouts/_base_header.html.erb b/app/views/layouts/_base_header.html.erb index 8a066d4f..cbc37f69 100644 --- a/app/views/layouts/_base_header.html.erb +++ b/app/views/layouts/_base_header.html.erb @@ -1,23 +1,13 @@ <% request.headers['REQUEST_URI'] = "" if request.headers['REQUEST_URI'].nil? realUrl = request.original_url - if (realUrl.match(/users/)) - @nav_dispaly_home_path_label = 1 - @nav_dispaly_main_course_label = 1 - @nav_dispaly_main_project_label = 1 - elsif (realUrl.match(/contest/)) - @nav_dispaly_contest_label = 1 - elsif (realUrl.match(/calls/)) - @nav_dispaly_home_path_label = 1 - @nav_dispaly_bid_label = 1 - elsif (realUrl.match(/forums/)) - @nav_dispaly_forum_label = 1 - elsif (realUrl.match(/forge\.trustie\.net\/*/)) + if (realUrl.match(/forge\.trustie\.net\/*/)) @nav_dispaly_project_label = 1 @nav_dispaly_forum_label = 1 elsif (realUrl.match(/course\.trustie\.net\/*/)) @nav_dispaly_course_all_label = 1 @nav_dispaly_forum_label = 1 + @nav_dispaly_course_label = nil @nav_dispaly_store_all_label = 1 elsif (realUrl.match(/user\.trustie\.net\/*/)) @nav_dispaly_home_path_label = 1