142 lines
5.6 KiB
Plaintext
142 lines
5.6 KiB
Plaintext
<%
|
|
request.headers['REQUEST_URI'] = "" if request.headers['REQUEST_URI'].nil?
|
|
realUrl = request.original_url
|
|
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
|
|
#@nav_dispaly_main_course_label = 1
|
|
#@nav_dispaly_main_project_label = 1
|
|
#@nav_dispaly_main_contest_label = 1
|
|
elsif (realUrl.match(/.*contest\.trustie\.net\/*/))
|
|
#@nav_dispaly_contest_label = 1
|
|
#@nav_dispaly_store_all_label = 1
|
|
else
|
|
#@nav_dispaly_project_all_label = 1
|
|
#@nav_dispaly_course_all_label = 1
|
|
#@nav_dispaly_forum_label = 1
|
|
#@nav_dispaly_bid_label = 1
|
|
#@nav_dispaly_contest_label = 1
|
|
#@nav_dispaly_store_all_label = 1
|
|
#@nav_dispaly_user_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")%>
|
|
</div>
|
|
<div id="account">
|
|
<%= render_menu :account_menu -%>
|
|
</div>
|
|
<% if User.current.logged? -%>
|
|
<div id="loggedas">
|
|
<ul style="padding:0 0; margin:0 0;display:inline;">
|
|
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;" class="loggedas_li">
|
|
<%=link_to_user(User.current)%>
|
|
<ul class="sub_menu">
|
|
<% if @show_course == 1 %>
|
|
<% if User.current.user_extensions && [UserExtensions::TEACHER, UserExtensions::STUDENT].include?(User.current.user_extensions.identity) -%>
|
|
<% hasCourse=true%>
|
|
|
|
<li id="course_loggedas_li"><%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id, host: Setting.course_domain} %>
|
|
<ul class="course_sub_menu">
|
|
<% User.current.courses.each do |course| %>
|
|
<% if !course_endTime_timeout?(course) %>
|
|
<li><%= link_to course.name.truncate(10, omission: '...'), {:controller => 'courses',:action => 'show',id:course.id, host: Setting.course_domain} %></li>
|
|
<% end %>
|
|
<% end %>
|
|
</ul>
|
|
</li>
|
|
|
|
<% end -%>
|
|
<% end %>
|
|
<li id="project_loggedas_li"><%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.project_domain} %>
|
|
|
|
<% if hasCourse %>
|
|
<ul class="project_sub_menu" style="top: 35px">
|
|
<% else %>
|
|
<ul class="project_sub_menu">
|
|
<% end %>
|
|
<% User.current.projects.each do |project| %>
|
|
<li><%= link_to project.name.truncate(10, omission: '...'), {:controller => 'projects', :action => 'show',id: project.id, host: Setting.project_domain } %></li>
|
|
<% end %>
|
|
</ul>
|
|
</li>
|
|
<li><%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.user_domain}%>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li style="padding:0 0; margin:0 0;display:inline;border-bottom: 0;">
|
|
<%=link_to l(:label_my_message)+'('+User.current.count_new_jour.to_s+')', { :controller => 'users', :action => 'user_newfeedback', id: User.current.id, host: Setting.user_domain }, {:class => 'my-message'} if User.current.logged?%>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<% end -%>
|
|
<%#= 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>
|
|
|
|
<script type="text/javascript">
|
|
function setMessageCount () {
|
|
var mes = $('#loggedas .my-message')
|
|
mes.html(mes.html()+'('+<%=User.current.count_new_jour.to_s%>+")")
|
|
}
|
|
|
|
function addSlipMenu () {
|
|
var loggedas = $('#loggedas ul li:first')
|
|
var sub_menu = $('.sub_menu')
|
|
loggedas.mouseenter(function(event) {
|
|
sub_menu.show();
|
|
});
|
|
sub_menu.mouseleave(function(event) {
|
|
sub_menu.hide();
|
|
});
|
|
}
|
|
|
|
function addProjectSlipMenu () {
|
|
var loggedas = $('#project_loggedas_li')
|
|
var project_sub_menu = $('.project_sub_menu')
|
|
var course_sub_menu = $('.course_sub_menu')
|
|
loggedas.mouseenter(function(event) {
|
|
course_sub_menu.hide();
|
|
project_sub_menu.show();
|
|
});
|
|
project_sub_menu.mouseleave(function(event) {
|
|
project_sub_menu.hide();
|
|
});
|
|
}
|
|
function addCourseSlipMenu () {
|
|
var loggedas = $('#course_loggedas_li')
|
|
var project_sub_menu = $('.project_sub_menu')
|
|
var course_sub_menu = $('.course_sub_menu')
|
|
loggedas.mouseenter(function(event) {
|
|
project_sub_menu.hide();
|
|
course_sub_menu.show();
|
|
});
|
|
course_sub_menu.mouseleave(function(event) {
|
|
course_sub_menu.hide();
|
|
});
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
addSlipMenu();
|
|
addProjectSlipMenu ();
|
|
addCourseSlipMenu();
|
|
});
|
|
|
|
jQuery(document).ready(function($) {
|
|
$('.sub_menu').find("a").attr('target', '_blank');
|
|
$('.project_sub_menu').find("a").attr('target', '_blank');
|
|
$('.course_sub_menu').find("a").attr('target', '_blank');
|
|
});
|
|
</script>
|