socialforge/app/views/welcome/_search_project.html.erb

101 lines
2.9 KiB
Plaintext

<%
select_option = []
(select_option << [l(:label_select_project), 'projects']) if project_type == Project::ProjectType_project
(select_option << [l(:label_select_course), 'courses']) if project_type == Project::ProjectType_course
select_option << [l(:label_select_user), 'users']
%>
<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;
margin-left: 0px;
-webkit-appearance: none;
-moz-appearance: none;
text-indent: 0.01px;
text-overflow: '';
}
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;
margin-left: 0px;
-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;
float: right;
}
.search_widget:hover{
box-shadow: 0px 0px 3px #56B4EF;
}
<%#完了把上面东西放到 .css 里%>
</style>
<script type="text/javascript">
function searchTypeChange()
{
if($("#search_type").val() == "users")
{
$("#search_by").show();
}
else
{
$("#search_by").hide();
}
}
function searchByChange()
{
$("#search_by_input").val($("#search_by").val());
}
</script>
<%= form_tag({controller: :welcome, action: :search }, method: :get) do %>
<div class="project-search" style="float: right">
<%= submit_tag l(:label_search), :class => "enterprise", :name => nil,:style =>"float: right; margin-left:3px;margin-top:2px" %>
<div class='search_widget' >
<%= text_field_tag :q, nil, :placeholder => l(:label_search_information), style:"float:left;" %>
<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" ) %>
<%= select_tag(:search_by,options_for_select([[l(:label_select_user_nickname),"0"],[l(:label_select_user_showname),"1"],[l(:label_select_user_email),"2"]]), :onchange => "searchByChange();",:style => "float:right" ) %>
</div>
<%#= hidden_field_tag 'project_type', project_type %>
</div>
<% end %>