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

6 years ago
<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>
6 years ago
<%= link_to '新建', new_library_path, class: 'fr color-blue font-16 mt3' %>
6 years ago
</p>
<div class="clearfix pt20 pl30 pr30">
<ul class="fl library_nav">
6 years ago
<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>
6 years ago
</ul>
6 years ago
<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">
6 years ago
<a href="javascript:void(0);" class="edu-btn-search font-16 color-grey" id="search"><i class="fa fa-search"></i></a>
6 years ago
</div>
6 years ago
</div>
6 years ago
</div>
6 years ago
<div class="library-list-container">
<%= render partial: 'library_list' %>
6 years ago
</div>
</div>
<script>
$(function(){
6 years ago
$(".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();
}
});
6 years ago
})
</script>