2016-03-05 03:14:57 +08:00
|
|
|
<div class="navHomepage">
|
|
|
|
<div class="navHomepageLogo fl">
|
|
|
|
<%=link_to image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3"), user_activities_path(User.current.id)%>
|
|
|
|
</div>
|
|
|
|
<div class="fl">
|
|
|
|
<ul>
|
|
|
|
<li class="navHomepageMenu fl">
|
2016-04-25 14:14:26 +08:00
|
|
|
<%= link_to "首页",user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页"%>
|
2016-03-05 03:14:57 +08:00
|
|
|
</li>
|
|
|
|
<li class="navHomepageMenu fl">
|
2016-04-25 14:14:26 +08:00
|
|
|
<%= link_to "资源库", user_resource_user_path(User.current, :type => 6), :class => "c_white f16 db p10" %>
|
|
|
|
</li>
|
2016-03-05 03:14:57 +08:00
|
|
|
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
|
|
|
|
<li class="navHomepageMenu fl">
|
2016-04-25 14:14:26 +08:00
|
|
|
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
2016-03-05 03:14:57 +08:00
|
|
|
</li>
|
|
|
|
<% else %>
|
|
|
|
<li class="navHomepageMenu fl">
|
2016-04-25 14:14:26 +08:00
|
|
|
<%= link_to "我的作业", student_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
2016-03-05 03:14:57 +08:00
|
|
|
</li>
|
|
|
|
<% end %>
|
|
|
|
<li class="navHomepageMenu fl mr30">
|
|
|
|
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
|
|
$(function(){
|
|
|
|
$("#navHomepageSearchInput").keypress(function(e){
|
|
|
|
var name = $.trim($('#navHomepageSearchInput').val());
|
|
|
|
if (e.keyCode == '13' && name != "" && name.length != 0) {
|
|
|
|
//$('#type').val($('input[type=radio]:checked').val());
|
|
|
|
$(this).parent().submit();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
});
|
|
|
|
|
|
|
|
function search_in_header(obj){
|
|
|
|
var name = $.trim($('#navHomepageSearchInput').val());
|
|
|
|
if (name != "" && name.length != 0) {
|
|
|
|
//$('#type').val($('input[type=radio]:checked').val());
|
|
|
|
obj.parent().submit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<div class="fl" id="navHomepageSearch">
|
|
|
|
<!--<form class="navHomepageSearchBox">-->
|
|
|
|
<% name = name%>
|
|
|
|
|
|
|
|
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
|
2016-07-01 11:11:53 +08:00
|
|
|
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的班级、项目、用户、资源以及帖子"/>
|
2016-03-05 03:14:57 +08:00
|
|
|
<input type="hidden" name="search_type" id="type" value="all"/>
|
|
|
|
<input type="text" style="display: none;"/>
|
|
|
|
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="navHomepageProfile" id="navHomepageProfile">
|
|
|
|
<ul>
|
|
|
|
<li class="homepageProfileMenuIcon" id="homepageProfileMenuIcon">
|
|
|
|
<%= link_to "<div class='mt5 mb8' id='user_avatar'>#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe,user_activities_path(User.current.id)%>
|
|
|
|
<ul class="topnav_login_list none" id="topnav_login_list">
|
|
|
|
<li>
|
|
|
|
<%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<%= link_to "我的组织", user_organizations_user_path(:id => User.current.id), :class => "menuGrey"%>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<%= link_to "新建组织", new_organization_path, :class => "menuGrey"%>
|
|
|
|
</li>
|
|
|
|
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
|
|
|
|
<li>
|
2016-03-14 15:39:45 +08:00
|
|
|
<%= link_to "退出",logout_url_without_domain,:class => "menuGrey",:method => "post"%>
|
2016-03-05 03:14:57 +08:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
2016-06-03 08:59:17 +08:00
|
|
|
<div class="navHomepageNews" id="user_messages">
|
2016-03-05 03:14:57 +08:00
|
|
|
<%= link_to "", user_message_path(User.current), :class => "homepageNewsIcon", :target =>"_Blank", :title => "您的所有消息" %>
|
2016-03-10 14:52:49 +08:00
|
|
|
<% if User.current.count_new_message.to_i >0 %>
|
2016-03-05 03:14:57 +08:00
|
|
|
<div ><%= link_to User.current.count_new_message , user_message_path(User.current), :class => "newsActive", :target =>"_Blank" %></div>
|
|
|
|
<% end %>
|
|
|
|
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
|
2016-06-12 14:20:55 +08:00
|
|
|
<div class="shadowbox_news undis" id="user_messages_list">
|
|
|
|
<%=render :partial => 'layouts/message_loading' %>
|
|
|
|
</div>
|
2016-03-05 03:14:57 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="text/javascript">
|
2016-06-20 15:38:43 +08:00
|
|
|
var onUserMessages = false;
|
|
|
|
var onNotice = false;
|
2016-03-05 03:14:57 +08:00
|
|
|
//搜索相关
|
|
|
|
$("#navHomepageSearch").mouseover(function(){
|
|
|
|
$("#navHomepageSearchType").show();
|
|
|
|
}).mouseout(function(){
|
|
|
|
$("#navHomepageSearchType").hide();
|
|
|
|
});
|
|
|
|
|
2016-06-12 14:20:55 +08:00
|
|
|
$("#user_messages").mouseenter(function(){
|
2016-06-20 15:38:43 +08:00
|
|
|
onNotice = true;
|
2016-06-03 08:59:17 +08:00
|
|
|
$("#user_messages_list").show();
|
2016-06-20 15:38:43 +08:00
|
|
|
if($("#message_list_detail").length == 0){
|
|
|
|
$.get('<%=user_messages_unviewed_users_path %>');
|
|
|
|
$("#ajax-indicator").hide();
|
|
|
|
}
|
|
|
|
var obj = $("#user_messages_list");
|
|
|
|
clearTimeout(obj.timer);
|
2016-06-03 16:28:11 +08:00
|
|
|
}).mouseleave(function(){
|
2016-06-20 15:38:43 +08:00
|
|
|
onNotice = false;
|
|
|
|
var obj = $("#user_messages_list");
|
2016-06-21 11:16:45 +08:00
|
|
|
setTimeout(function(){
|
|
|
|
if(!onNotice && !onUserMessages) {
|
|
|
|
obj.hide();
|
|
|
|
obj.html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>");
|
|
|
|
} }, 500);
|
2016-06-20 15:38:43 +08:00
|
|
|
});
|
2016-06-21 11:16:45 +08:00
|
|
|
$("#message_list_detail").mouseenter(function(event){
|
2016-06-20 15:38:43 +08:00
|
|
|
event.stopPropagation();
|
|
|
|
onUserMessages = true;
|
|
|
|
}).mouseleave(function(){
|
|
|
|
onUserMessages = false;
|
2016-06-12 14:20:55 +08:00
|
|
|
});
|
2016-06-03 08:59:17 +08:00
|
|
|
|
2016-03-05 03:14:57 +08:00
|
|
|
$("#navHomepageProfile").mouseenter(function(){
|
|
|
|
$("#homepageProfileMenuIcon").addClass("homepageProfileMenuIconhover");
|
|
|
|
$("#topnav_login_list").show();
|
|
|
|
});
|
|
|
|
$("#navHomepageProfile").mouseleave(function(){
|
|
|
|
$("#homepageProfileMenuIcon").removeClass("homepageProfileMenuIconhover");
|
|
|
|
$("#topnav_login_list").hide();
|
|
|
|
});
|
|
|
|
|
|
|
|
function signout(){
|
|
|
|
$.post(
|
|
|
|
'<%= signout_path%>',
|
|
|
|
{}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
</script>
|