You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pgfqe6ch8/app/views/libraries/index.html.erb

51 lines
1.9 KiB

<div class="educontent">
<div class="edu-back-white mb30 mt30">
<p class="padding20-30 clearfix bor-bottom-greyE">
<span class="font-18 fl color-grey-3">文库</span>
<%= link_to '新建', new_library_path, class: 'fr color-blue font-16 mt3' %>
</p>
<div class="clearfix pt20 pl30 pr30">
<ul class="fl library_nav">
<li class="<%= params[:type] == 'mine' ? '' : 'active' %>">
<%= link_to '全部', libraries_path(search: params[:search]), remote: true %>
</li>
<li class="<%= params[:type] == 'mine' ? 'active' : '' %>">
<%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %>
</li>
</ul>
<div class="edu-position fr">
<%= hidden_field_tag(:type, params[:type]) %>
<input class="winput-240-30 panel-box-sizing" placeholder="输入文库标题、编号进行检索" type="text" id="search_name">
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a>
</div>
</div>
</div>
<div class="library-list-container">
<%= render partial: 'library_list' %>
</div>
</div>
<script>
$(function(){
$(".library_nav").on("click","li",function(){
$(".library_nav li").removeClass("active");
$(this).addClass("active");
});
var searchFunc = function() {
var search = $("#search_name").val();
var type = $("input[name='type']").val();
$.ajax({
url: "/libraries",
dataType: 'script',
data: {search: search, type: type}
});
};
$("#search").live("click", searchFunc);
$('#search_name').bind('keypress',function(event) {
if (event.keyCode == "13") {
searchFunc();
}
});
})
</script>