公共资源/我的资源JS实现

This commit is contained in:
huang 2016-03-02 16:54:07 +08:00
parent 6893b3dcab
commit c0077b7c9d
3 changed files with 15 additions and 11 deletions

View File

@ -1,7 +1,7 @@
<div id="users_setting">
<div class="resourcesUploadBox mt10"><a href="javascript:void(0);" onclick="show_upload();" class="uploadBoxIcon">上传资源</a></div>
<div id="search_div">
<%= render :partial => 'resource_search_form',:locals => {:user => @user, :type => @type} %>
<%= render :partial => 'users/resource_search_form',:locals => {:user => @user, :type => @type} %>
</div>
<div style="float: left; margin-top: 7px; font-size: 14px; margin-left: 15px;"><span style="align:center ;font-size: 14px;color: gray;">为您找到<span id="res_all_count"><%= @atta_count %></span>个资源</span></div>
</div>
@ -18,7 +18,7 @@
<div class="cl"></div>
<form id="resources_list_form">
<div id="resources_list">
<%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %>
<%= render :partial => 'users/resources_list' , :locals => { :attachments => @attachments} %>
</div>
<div class="cl"></div>
<div class="resource-list-option fl">

View File

@ -11,12 +11,12 @@
function remote_get_resources(user_id,type){
}
// $(document).ready(function(){
// $(".resource-switch").click(function(){
// $(".resource-switch").children().removeClass("resource-tab-active");
// $(this).children().addClass("resource-tab-active");
// });
// });
$(document).ready(function(){
$(".resource-switch").click(function(){
$(".resource-switch").children().removeClass("resource-tab-active");
$(this).children().addClass("resource-tab-active");
});
});
function remote_search(){
$("#resource_search_form").submit();
}
@ -72,8 +72,12 @@
<div class="resource-wrapper">
<ul class="resource-banner">
<li class="fl resource-switch"><a href="<%= user_resource_user_path %>;" class="resource-tab resource-tab-active">公共资源</a></li>
<li class="fl resource-switch"><a href="javascript:void(0);" onclick="show_my_resource();" class="resource-tab ">我的资源</a></li>
<li class="fl resource-switch">
<a href="<%= user_resource_user_path(@user, :type => '6') %>" id="user_homeworks_choose" class="resource-tab resource-tab-active" data-remote="true">公共资源</a>
</li>
<li class="fl resource-switch">
<a href="<%= user_resource_user_path(@user, :type => '1') %>" id="user_homeworks_choose" class="resource-tab" data-remote="true">我的资源</a>
</li>
<li class="fl w770 border-bottom h34">&nbsp;</li>
<li class="fr resource-banner-li border-bottom h34">
<ul class="resourcesSelect">

View File

@ -1,4 +1,4 @@
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form',:locals => {:user=>@user,:type=>@type} ) %>');
$("#search_div").html('<%= escape_javascript( render :partial => 'resource_search_form', :locals => {:user => @user, :type => @type} ) %>');
$("#resources_list").html('<%= escape_javascript( render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments})%>');
$("#pages").html('<%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>');
$("#res_count").html(0);