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

54 lines
2.0 KiB

5 years ago
<img src="/images/educoder/teach_ex.jpg" width="100%"/>
<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: 'white-btn edu-filter-btn-blue fr mr10 mt8', style: 'color: #4CACFF' %>
</p>
<div class="clearfix pl30 pr30">
<ul class="fl library_nav mt20">
<li class="<%= params[:type] == 'mine' ? '' : 'active' %>">
<%= link_to '全部', libraries_path(search: params[:search]), remote: true %>
</li>
<% if User.current.try(:logged?) %>
5 years ago
<li class="<%= params[:type] == 'mine' ? 'active' : '' %>">
<%= link_to '我的', libraries_path(search: params[:search], type: 'mine'), remote: true %>
</li>
<% end %>
</ul>
5 years ago
<div class="edu-position fr mt12 mb10">
<%= hidden_field_tag(:type, params[:type]) %>
<input class="winput-300-35 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_path %>",
dataType: 'script',
data: {search: search, type: type}
});
};
$("#search").live("click", searchFunc);
$('#search_name').bind('keypress',function(event) {
if (event.keyCode == "13") {
searchFunc();
}
});
})
5 years ago
</script>