资源库 分页

This commit is contained in:
lizanle 2015-08-20 17:00:54 +08:00
parent 7ddf6d1e7d
commit 0e8c1d1b66
4 changed files with 32 additions and 13 deletions

View File

@ -1266,6 +1266,12 @@ class UsersController < ApplicationController
end end
end end
@type = params[:type] @type = params[:type]
@limit = 10
@obj_count = @attachments.count
@obj_pages = Paginator.new @obj_count, @limit, params['page'] || 1
@offset ||= @obj_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit]
@attachments = paginateHelper @attachments,10
respond_to do |format| respond_to do |format|
format.js format.js
format.html {render :layout => 'base_users_new'} format.html {render :layout => 'base_users_new'}
@ -1308,6 +1314,12 @@ class UsersController < ApplicationController
end end
end end
@type = params[:type] @type = params[:type]
@limit = 10
@obj_count = @attachments.count
@obj_pages = Paginator.new @obj_count, @limit, params['page'] || 1
@offset ||= @obj_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit]
@attachments = paginateHelper @attachments,10
respond_to do |format| respond_to do |format|
format.js format.js
end end

View File

@ -1,11 +1,11 @@
var screenWidth = $(window).width(); //var screenWidth = $(window).width();
var screenHeight = $(window).height(); //当前浏览器窗口的 宽高 //var screenHeight = $(window).height(); //当前浏览器窗口的 宽高
var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 //var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度
var objLeft = (screenWidth - 2)/2.5 ; //2 可以根据需要修改 //var objLeft = (screenWidth - 2)/2.5 ; //2 可以根据需要修改
var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改 //var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改
var popupHeight = $(".resourceSharePopup").outerHeight(true); var popupHeight = $(".resourceSharePopup").outerHeight(true);
$(".resourceSharePopup").css("marginTop",-popupHeight/2); $(".resourceSharePopup").css("marginTop",-popupHeight/2);
$("#upload_box").css('left',objLeft).css('top',objTop); $("#upload_box").css('left','').css('top','');
$("#upload_box").html('<%= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); $("#upload_box").html('<%= escape_javascript( render :partial => "resource_share_popup" ,:locals => {:courses=>@course,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
$("#upload_box").css('display','block'); $("#upload_box").css('display','block');

View File

@ -1,11 +1,11 @@
var screenWidth = $(window).width(); //var screenWidth = $(window).width();
var screenHeight = $(window).height(); //当前浏览器窗口的 宽高 //var screenHeight = $(window).height(); //当前浏览器窗口的 宽高
var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度 //var scrolltop = $(document).scrollTop();//获取当前窗口距离页面顶部高度
var objLeft = (screenWidth - 2)/2.5 ; //2 可以根据需要修改 //var objLeft = (screenWidth - 2)/2.5 ; //2 可以根据需要修改
var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改 //var objTop = (screenHeight - 100)/2 + scrolltop; //100可以根据需要修改
var popupHeight = $(".resourceSharePopup").outerHeight(true); var popupHeight = $(".resourceSharePopup").outerHeight(true);
$(".resourceSharePopup").css("marginTop",-popupHeight/2); $(".resourceSharePopup").css("marginTop",-popupHeight/2);
$("#upload_box").css('left',objLeft).css('top',objTop); $("#upload_box").css('left','').css('top','');
$("#upload_box").html('<%= escape_javascript( render :partial => "resource_share_for_project_popup" ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>'); $("#upload_box").html('<%= escape_javascript( render :partial => "resource_share_for_project_popup" ,:locals => {:projects=>@projects,:user=>@user,:send_id=>@send_id,:send_ids=>@send_ids})%>');
$("#upload_box").css('display','block'); $("#upload_box").css('display','block');

View File

@ -103,6 +103,10 @@
</div> </div>
</form> </form>
</div> </div>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>
</ul>
<div class="cl"></div>
<div id="upload_box" style="display: none"> <div id="upload_box" style="display: none">
<%= render :partial => 'upload_resource' ,:locals => {:user=>@user}%> <%= render :partial => 'upload_resource' ,:locals => {:user=>@user}%>
</div> </div>
@ -284,6 +288,9 @@ $(".resourcesList").click(function(e) {
} }
function batch_send(){ function batch_send(){
if($("#resources_list_form").serialize() == ""){
return ;
}
if (lastSendType === '1'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 if (lastSendType === '1'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
$.ajax({ $.ajax({
type: 'get', type: 'get',
@ -411,7 +418,7 @@ $(".resourcesList").click(function(e) {
}); });
} }
}else{//如果是多个发送 }else{//如果是多个发送
if (sendType === '1'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。 if (sendType === '1'){
$.ajax({ $.ajax({
type: 'get', type: 'get',
url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize() url: '<%= search_user_course_user_path(@user)%>' + '?'+ $("#resources_list_form").serialize()