2014-12-31 08:48:14 +08:00
|
|
|
<%
|
|
|
|
select_option = []
|
2015-02-09 22:07:21 +08:00
|
|
|
(select_option << [l('welcome.search.select.project'), 'projects']) if project_type == Project::ProjectType_project
|
|
|
|
(select_option << [l('welcome.search.select.course'), 'courses']) if project_type == Project::ProjectType_course
|
|
|
|
select_option << [l('welcome.search.select.user'), 'users']
|
2014-12-31 08:48:14 +08:00
|
|
|
%>
|
|
|
|
<style type="text/css">
|
|
|
|
form #q, form #search_type{
|
|
|
|
-webkit-box-sizing: border-box;
|
|
|
|
-moz-box-sizing: border-box;
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: inline-block;
|
|
|
|
margin: 0px;
|
|
|
|
padding: 5px;
|
|
|
|
height: 33px;
|
|
|
|
}
|
|
|
|
form #q{
|
|
|
|
font-size: 13px;
|
|
|
|
border-top-left-radius: 5px;
|
|
|
|
border-bottom-left-radius: 5px;
|
|
|
|
border-right: none;
|
|
|
|
|
|
|
|
}
|
|
|
|
form #search_type{
|
|
|
|
font-size: 13px;
|
|
|
|
color: #363739;
|
|
|
|
border-top-right-radius: 5px;
|
|
|
|
border-bottom-right-radius: 5px;
|
|
|
|
border-bottom-left-radius: 0px;
|
|
|
|
border-top-left-radius: 0px;
|
|
|
|
border-left: 1px outset #83A9A9;
|
2015-01-07 17:28:45 +08:00
|
|
|
margin-left: 0px;
|
2014-12-31 08:48:14 +08:00
|
|
|
-webkit-appearance: none;
|
|
|
|
-moz-appearance: none;
|
|
|
|
text-indent: 0.01px;
|
|
|
|
text-overflow: '';
|
2015-06-15 11:18:44 +08:00
|
|
|
padding-right:10px;
|
|
|
|
background-image:url(/images/arrow_expanded.png)!important;
|
|
|
|
background:no-repeat right;
|
2014-12-31 08:48:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
form #search_by
|
|
|
|
{
|
|
|
|
font-size: 13px;
|
|
|
|
color: #363739;
|
|
|
|
border-top-right-radius: 5px;
|
|
|
|
border-bottom-right-radius: 5px;
|
|
|
|
border-bottom-left-radius: 0px;
|
|
|
|
border-top-left-radius: 0px;
|
|
|
|
border-left: 1px outset #83A9A9;
|
2015-01-07 17:28:45 +08:00
|
|
|
margin-left: 0px;
|
2014-12-31 08:48:14 +08:00
|
|
|
-webkit-appearance: none;
|
|
|
|
-moz-appearance: none;
|
|
|
|
text-indent: 0.01px;
|
|
|
|
text-overflow: '';
|
|
|
|
-moz-box-sizing: border-box;
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: inline-block;
|
|
|
|
padding: 5px;
|
|
|
|
height: 33px;
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.search_widget{
|
|
|
|
display:inline-block;
|
|
|
|
border-radius: 5px;
|
2015-01-31 14:37:24 +08:00
|
|
|
float: right;
|
2014-12-31 08:48:14 +08:00
|
|
|
}
|
|
|
|
.search_widget:hover{
|
|
|
|
box-shadow: 0px 0px 3px #56B4EF;
|
|
|
|
}
|
|
|
|
<%#完了把上面东西放到 .css 里%>
|
|
|
|
</style>
|
2015-06-15 11:18:44 +08:00
|
|
|
<!--[if IE]>
|
|
|
|
<!--<style type="text/css">-->
|
|
|
|
<!--form #search_type{-->
|
|
|
|
<!--background:none!important;-->
|
|
|
|
<!--}-->
|
|
|
|
<!--</style>-->
|
|
|
|
<![endif]-->
|
|
|
|
<script type="text/javascript">
|
|
|
|
$(function(){
|
|
|
|
var userAgent = navigator.userAgent.toLowerCase();
|
|
|
|
if(/trident/.test(userAgent)){
|
|
|
|
$('form #search_type').css({'background-image':'none!important'});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2014-12-31 08:48:14 +08:00
|
|
|
<script type="text/javascript">
|
|
|
|
function searchTypeChange()
|
|
|
|
{
|
|
|
|
if($("#search_type").val() == "users")
|
|
|
|
{
|
2016-01-22 17:27:21 +08:00
|
|
|
$("#q").attr('placeholder','登录名/姓名/邮箱');
|
2015-06-05 11:39:55 +08:00
|
|
|
// $("#search_by").show();
|
2014-12-31 08:48:14 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$("#search_by").hide();
|
2015-06-05 11:39:55 +08:00
|
|
|
$("#q").attr('placeholder',"<%=l('welcome.search.information')%>");
|
2014-12-31 08:48:14 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function searchByChange()
|
|
|
|
{
|
|
|
|
$("#search_by_input").val($("#search_by").val());
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
|
2015-01-23 15:08:34 +08:00
|
|
|
<div class="project-search" style="float: right">
|
2015-01-31 14:37:24 +08:00
|
|
|
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil,:style =>"float: right; margin-left:3px;margin-top:2px" %>
|
2015-01-07 17:28:45 +08:00
|
|
|
<div class='search_widget' >
|
2015-04-10 17:58:59 +08:00
|
|
|
<%= text_field_tag :q, nil, :placeholder => l('welcome.search.information'), style:"float:left; width:185px;" %>
|
2015-01-07 17:28:45 +08:00
|
|
|
<input type="text" name="search_by_input" style="display: none" id="search_by_input" value="0">
|
|
|
|
<%= select_tag(:search_type, options_for_select(select_option), :onchange => "searchTypeChange();", :style => "float:right" ) %>
|
2015-06-05 11:39:55 +08:00
|
|
|
<%= select_tag(:search_by,options_for_select([[l('welcome.search.select.userinfo.nickname'),"0"],[l('welcome.search.select.userinfo.showname'),"1"],[l('welcome.search.select.userinfo.email'),"2"]]), :onchange => "searchByChange();",:style => "float:right;display:none;" ) %>
|
2014-12-31 08:48:14 +08:00
|
|
|
</div>
|
|
|
|
<%#= hidden_field_tag 'project_type', project_type %>
|
2015-01-31 14:37:24 +08:00
|
|
|
</div>
|
2014-12-31 08:48:14 +08:00
|
|
|
<% end %>
|