实现课程搜索
This commit is contained in:
parent
ec1ff6dfc3
commit
16872597b6
|
@ -17,6 +17,7 @@
|
|||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= stylesheet_link_tag 'leftside', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'courses', :media => 'all' %>
|
||||
<%= javascript_include_tag "course" %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
</head>
|
||||
|
@ -27,14 +28,31 @@
|
|||
|
||||
<div id="TopBar">
|
||||
<div class="topbar_info02 fl">
|
||||
<h2><a href="#" target="_blank" class="c_blue">高校课程实践社区 </a></h2>
|
||||
<p>当前位置 :<a href="#" target="_blank" >主页</a> ><a href="#" target="_blank"> 课程实践平台</a> ><a href="#" target="_blank"> 分布式计算环境</a></p>
|
||||
<h2>
|
||||
<a href="http://<%= Setting.host_course%>" target="_blank" class="c_blue">
|
||||
<%= l(:label_courses_community)%>
|
||||
</a>
|
||||
</h2>
|
||||
<p>
|
||||
<%= l(:label_user_location) %> :
|
||||
<%= link_to l(:field_homepage), home_path %>
|
||||
>
|
||||
<a href="http://<%= Setting.host_course%>">
|
||||
<%=l(:label_courses_management_platform)%>
|
||||
</a>
|
||||
>
|
||||
<%= link_to @course.name, nil %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="search fl">
|
||||
<form class="search_form" >
|
||||
<input type="text" name="serach" placeholder="项目名称、课程名称、昵称、姓名、邮箱" class="search_text fl">
|
||||
<a href="#" class="search_btn fl f14 c_white" >搜 索</a>
|
||||
</form>
|
||||
<%= form_tag({:controller => 'courses', :action => 'search'},:id => "course_search_form", :method => :get, :class => "search_form") do %>
|
||||
<%= text_field_tag 'name', params[:name], :placeholder => "课程名称", :class => "search_text fl", :onkeyup => "regexName('#{l(:label_search_conditions_not_null)}');" %>
|
||||
<a href="#" onclick="submitSerch('<%= l(:label_search_conditions_not_null) %>');" class="search_btn fl f14 c_white" >
|
||||
<%= l(:label_search)%>
|
||||
</a>
|
||||
<br />
|
||||
<span id="project_name_span" style="float: left"></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div><!--TopBar end-->
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
function regexName(content)
|
||||
{
|
||||
var name = $.trim($("#name").val());
|
||||
if(name.length == 0)
|
||||
{
|
||||
$("#project_name_span").text(content);
|
||||
$("#project_name_span").css('color','#ff0000');
|
||||
$("#project_name_span").focus();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$("#project_name_span").text("");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function submitSerch(content)
|
||||
{
|
||||
if(regexName(content)){$("#course_search_form").submit();}
|
||||
}
|
Loading…
Reference in New Issue