fix main page navigation

This commit is contained in:
xianbo 2014-03-29 11:02:05 +08:00
parent c38a8e4f6a
commit 6e065361b3
3 changed files with 50 additions and 48 deletions

View File

@ -1501,19 +1501,19 @@ module ApplicationHelper
def render_dynamic_nav
home_link = link_to l(:field_homepage), {:controller => 'welcome', :action => 'index'}
course_all_course_link = link_to l(:label_course_all), {:controller => 'projects', :action => 'course', :project_type => 1}
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher'}
courses_link = link_to l(:label_course_practice), {:controller => 'projects', :action => 'course', :project_type => 1}
projects_link = link_to l(:label_project_deposit), {:controller => 'projects', :action => 'index', :project_type => 0}
users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index'}
contest_link = link_to l(:label_contest_innovate), {:controller => 'bids', :action => 'contest', :project_type => 1 }
course_all_course_link = link_to l(:label_course_all), {:controller => 'projects', :action => 'course', :project_type => 1, :subdomain => Setting.course_domain}
course_teacher_all_link = link_to l(:label_teacher_all), {:controller => 'users', :action => 'index', :role => 'teacher', :subdomain => Setting.course_domain}
courses_link = link_to l(:label_course_practice), {:controller => 'projects', :action => 'course', :project_type => 1, :subdomain => Setting.course_domain}
projects_link = link_to l(:label_project_deposit), {:controller => 'projects', :action => 'index', :project_type => 0, :subdomain => Setting.project_domain}
users_link = link_to l(:label_software_user), {:controller => 'users', :action => 'index', :subdomain => Setting.user_domain}
contest_link = link_to l(:label_contest_innovate), {:controller => 'bids', :action => 'contest', :project_type => 1 , :subdomain => Setting.project_domain}
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
forum_link = link_to l(:label_project_module_forums), {:controller => "forums", :action => "index"}
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index'}
stores_link = link_to l(:label_stores_index), {:controller => 'stores', :action=> 'index', :subdomain => Setting.course_domain}
#@nav_dispaly_project_label
nav_list = Array.new
nav_list.push(home_link)
nav_list.push(home_link) if !@nav_dispaly_home_path_label
nav_list.push(course_all_course_link) if @nav_dispaly_course_all_label
nav_list.push(course_teacher_all_link) if @nav_dispaly_teacher_all_label

View File

@ -1,3 +1,45 @@
<%
request.headers['REQUEST_URI'] = "" if request.headers['REQUEST_URI'].nil?
realUrl = request.original_url
if (realUrl.match(/project\/course/))
@nav_dispaly_course_label = 1
elsif (realUrl.match(/users/))
@nav_dispaly_home_path_label = 1
@nav_dispaly_course_all_label = 1
@nav_dispaly_project_label = 1
elsif (realUrl.match(/projects/))
@nav_dispaly_project_label = 1
elsif (realUrl.match(/contest/))
@nav_dispaly_contest_label = 1
elsif (realUrl.match(/calls/))
@nav_dispaly_bid_label = 1
elsif (realUrl.match(/forums/))
@nav_dispaly_forum_label = 1
elsif (realUrl.match(/[^forge]\/course[^\.]/))
@nav_dispaly_course_label = 1
@nav_dispaly_project_label = 1
@nav_dispaly_contest_label = 1
elsif (realUrl.match(/course\.trustie\.net/))
@nav_dispaly_course_all_label = 1
# @nav_dispaly_teacher_all_label = 1
@nav_dispaly_forum_label = 1
elsif (realUrl.match(/user\.trustie\.net/))
@nav_dispaly_home_path_label = 1
@nav_dispaly_course_all_label = 1
@nav_dispaly_project_label = 1
elsif (realUrl.match(/forge\.trustie\.net/))
@nav_dispaly_project_label = 1
@nav_dispaly_user_label = 1
@nav_dispaly_forum_label = 1
else
@nav_dispaly_course_label = 1
@nav_dispaly_project_label = 1
@nav_dispaly_user_label = 1
@nav_dispaly_contest_label = 1
@nav_dispaly_bid_label = 1
@nav_dispaly_forum_label = 1
end
%>
<div id="top-menu" style="background-color: #15bccf;height:40px;margin-top: 10px;margin-bottom: 10px;">
<div class="welcome_logo">
<%=link_to image_tag("/images/logo.png",weight:"36px", height: "36px"), home_path %>

View File

@ -1,43 +1,3 @@
<%
request.headers['REQUEST_URI'] = "" if request.headers['REQUEST_URI'].nil?
realUrl = request.original_url
if (realUrl.match(/project\/course/))
@nav_dispaly_course_label = 1
elsif (realUrl.match(/projects/))
@nav_dispaly_project_label = 1
elsif (realUrl.match(/users/))
@nav_dispaly_user_label = 1
elsif (realUrl.match(/contest/))
@nav_dispaly_contest_label = 1
elsif (realUrl.match(/calls/))
@nav_dispaly_bid_label = 1
elsif (realUrl.match(/forums/))
@nav_dispaly_forum_label = 1
elsif (realUrl.match(/[^forge]\/course[^\.]/))
@nav_dispaly_course_label = 1
@nav_dispaly_project_label = 1
@nav_dispaly_contest_label = 1
elsif (realUrl.match(/course\.trustie\.net/))
@nav_dispaly_course_all_label = 1
# @nav_dispaly_teacher_all_label = 1
@nav_dispaly_forum_label = 1
elsif (realUrl.match(/user\.trustie\.net/))
@nav_dispaly_project_label = 1
# @nav_dispaly_user_label = 1
@nav_dispaly_forum_label = 1
elsif (realUrl.match(/forge\.trustie\.net/))
@nav_dispaly_project_label = 1
@nav_dispaly_user_label = 1
@nav_dispaly_forum_label = 1
else
@nav_dispaly_course_label = 1
@nav_dispaly_project_label = 1
@nav_dispaly_user_label = 1
@nav_dispaly_contest_label = 1
@nav_dispaly_bid_label = 1
@nav_dispaly_forum_label = 1
end
%>
<!DOCTYPE html>
<html lang="<%= current_language %>">
<head>