socialforge/app/views/layouts/_unlogin_header.html.erb

96 lines
3.5 KiB
Plaintext
Raw Normal View History

2015-08-18 11:47:22 +08:00
<div class="navHomepage">
<div class="navHomepageLogo fl">
2015-08-28 11:55:34 +08:00
<%=link_to image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3"), signin_path%>
2015-08-18 11:47:22 +08:00
</div>
<div class="fl">
<ul>
2015-08-28 11:55:34 +08:00
<li class="navHomepageMenu fl mr40">
2015-08-25 17:30:55 +08:00
<a href="http://forge.trustie.net/forums/1/memos/1168" class="c_white f16">帮助中心</a>
</li>
2015-08-18 11:47:22 +08:00
</ul>
</div>
2015-08-29 17:04:44 +08:00
<script>
function search(doc){
//alert(1)
// val = $('input:radio[name="search_type"]:checked').val();
// alert(2)
// $("#search_type").val(val);
// alert(3)
$(doc).parent().submit();
}
<% type = type%>
$(function (){
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
$('input:radio[value="courses"]').attr('checked','checked');
}
if('<%= type %>' != null && '<%= type %>' == 'projects' ){
$('input:radio[value="projects"]').attr('checked','checked');
}
if('<%= type %>' != null && '<%= type %>' == 'users' ){
$('input:radio[value="users"]').attr('checked','checked');
}
});
2015-08-29 11:28:02 +08:00
2015-08-29 17:04:44 +08:00
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();
}
}
2015-08-29 16:14:02 +08:00
2015-08-29 17:04:44 +08:00
function search_in_header_I(e,obj){
var name = $.trim($('#navHomepageSearchInput').val());
if (e.keyCode == '13' && name != "" && name.length != 0) {
$('#type').val($('input[type=radio]:checked').val());
obj.parent().submit();
}
}
</script>
2015-08-24 16:16:07 +08:00
<div class="fl" id="navHomepageSearch">
2015-08-25 18:26:54 +08:00
<!--<form class="navHomepageSearchBox">-->
2015-08-25 18:59:45 +08:00
<% name = name%>
2015-08-25 18:26:54 +08:00
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
2015-08-29 17:04:44 +08:00
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" onkeypress="search_in_header_I(event,$(this));"/>
2015-08-29 16:14:02 +08:00
<input type="hidden" name="search_type" id="type" value=""/>
2015-08-29 17:04:44 +08:00
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>
2015-08-25 18:26:54 +08:00
<% end %>
2015-08-24 16:16:07 +08:00
<div class="navSearchTypeBox" id="navHomepageSearchType">
<div class="fl mr15 mt8">
2015-08-25 18:26:54 +08:00
<input type="radio" value="courses" name="search_type" checked/>
2015-08-24 16:16:07 +08:00
课程
</div>
<div class="fl mr15 mt8">
2015-08-25 18:26:54 +08:00
<input type="radio" value="projects" name="search_type" />
2015-08-24 16:16:07 +08:00
项目
</div>
<div class="fl mr15 mt8">
2015-08-25 18:26:54 +08:00
<input type="radio" value="users" name="search_type" />
用户
</div>
2015-08-24 16:16:07 +08:00
<div id="navSearchAlert" class="fr mr10">
<span class="c_red">请选择搜索类型</span>
</div>
</div>
2015-08-25 18:26:54 +08:00
2015-08-18 11:47:22 +08:00
</div>
<div id="loginInButton" class="fr ml20">
2015-08-25 16:08:52 +08:00
<a href="<%= signin_path(:login=>true) %>" class="c_white db">登录</a>
</div>
<div id="loginSignButton" class="fr">
2015-08-25 16:08:52 +08:00
<a href="<%= signin_path(:login=>false) %>" class="c_white db">注册</a>
2015-08-18 11:47:22 +08:00
</div>
</div>
2015-08-29 17:04:44 +08:00
<script type="text/javascript">
//搜索相关
$("#navHomepageSearch").mouseover(function(){
$("#navHomepageSearchType").show();
}).mouseout(function(){
$("#navHomepageSearchType").hide();
});
</script>