菜单栏调整

This commit is contained in:
yanxd 2014-01-23 10:08:46 +08:00
parent 7a047641ee
commit ecec98aac9
11 changed files with 61 additions and 1 deletions

View File

@ -1498,5 +1498,33 @@ module ApplicationHelper
end
end
end
def render_dynamic_nav
home_link = link_to l(:field_homepage), home_path
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}
bids_link = link_to l(:label_requirement_enterprise), {:controller => 'bids', :action => 'index'}
forum_link = link_to l(:label_project_module_forums), forums_path
stores_link = link_to l(:label_stores_index), stores_path
#@nav_dispaly_project_label
nav_list = Array.new
nav_list.push(home_link)
nav_list.push(courses_link) if @nav_dispaly_course_label
nav_list.push(projects_link) if @nav_dispaly_project_label
nav_list.push(users_link) if @nav_dispaly_user_label
nav_list.push(contest_link) if @nav_dispaly_contest_label
nav_list.push(bids_link) if @nav_dispaly_bid_label
nav_list.push(forum_link) if @nav_dispaly_forum_label
nav_list.push(stores_link)
content_li = ''
nav_list.collect do |nav_item|
content_li << content_tag(:li, nav_item)
end
content_tag :ul, content_li.html_safe
end
end

View File

@ -23,7 +23,9 @@
</ul>
</div>
<% end -%>
<%= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
<%#= render_menu :top_menu if User.current.logged? || !Setting.login_required? -%>
<%= render_dynamic_nav if User.current.logged? || !Setting.login_required? -%>
<%# 自建导航条在base页面中以 (@nav_dispaly......) 开头变量设定, 全局搜索即可发现 %>
</div>
<div style="border-top:solid 1px #C6E9F1;width:940px;margin-left:auto;margin-right:auto;margin-bottom: 0px;margin-top: -10px;"></div>
<div style="clear:left;"></div>

View File

@ -1,3 +1,25 @@
<%
if (request.headers['REQUEST_URI'].match(/course/))
@nav_dispaly_course_label = 1
elsif (request.headers['REQUEST_URI'].match(/projects/))
@nav_dispaly_project_label = 1
elsif (request.headers['REQUEST_URI'].match(/users/))
@nav_dispaly_user_label = 1
elsif (request.headers['REQUEST_URI'].match(/contest/))
@nav_dispaly_contest_label = 1
elsif (request.headers['REQUEST_URI'].match(/calls/))
@nav_dispaly_bid_label = 1
elsif (request.headers['REQUEST_URI'].match(/forums/))
@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>

View File

@ -1,3 +1,4 @@
<% @nav_dispaly_bid_label = 1 %>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -1,3 +1,4 @@
<% @nav_dispaly_contest_label = 1 %>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -1,3 +1,4 @@
<% @nav_dispaly_course_label = 1 %>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -1,3 +1,4 @@
<% @nav_dispaly_forum_label = 1%>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -1,3 +1,4 @@
<% @nav_dispaly_course_label = 1 %>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -1,3 +1,4 @@
<% @nav_dispaly_forum_label = 1%>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -1,3 +1,4 @@
<% @nav_dispaly_project_label = 1 %>
<!DOCTYPE html>
<html lang="en">
<head>

View File

@ -1,3 +1,4 @@
<% @nav_dispaly_user_label = 1 %>
<!DOCTYPE html>
<html lang="en">
<head>