1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-22 03:47:09 +00:00

fixed bugs

This commit is contained in:
llj
2013-08-21 15:36:51 +08:00
parent 251cc64005
commit 475e4ff7bf
2 changed files with 5 additions and 4 deletions

View File

@@ -1022,6 +1022,7 @@ $('#private-share-form').submit(function() {
return false;
}
});
var last_start = 0; // for 'list_dir_more'
$(window).scroll(function() {
var file_topbar = $('.repo-file-list-topbar'),
list_hd = $('.repo-file-list tr:first-child');
@@ -1032,10 +1033,12 @@ $(window).scroll(function() {
}
var ele_more = $('#repo-file-list .dirent-more');
if (ele_more.length == 1 && $(window).scrollTop() + $(window).height() >= $(document).height() - parseInt($('#repo-file-list').css('margin-bottom'))) {
if (ele_more.length == 1 && $(window).scrollTop() + $(window).height() >= $(document).height() - parseInt($('#repo-file-list').css('margin-bottom')) && ele_more.data('start') != last_start) {
last_start = ele_more.data('start');
$.ajax({
url:'{% url 'list_dir_more' repo.id %}?p=' + e(cur_path) + '&start=' + e(ele_more.data('start')),
dataType: 'json',
cache: false,
success: function(data) {
var more_dirents = $(data['html']);
more_dirents.appendTo($('.repo-file-list'));
@@ -1054,7 +1057,7 @@ $(window).scroll(function() {
opOnDirent(more_dirents);
$('#name-down, #name-up, #time-up, #time-down').unbind().click(sortDirent);
if (data['dirent_more']) {
ele_more.attr('data-start', data['more_start']);
ele_more.data('start', data['more_start']);
} else {
ele_more.remove();
}

View File

@@ -275,8 +275,6 @@ def list_dir_more(request, repo_id):
'path': path,
'dir_list': dir_list,
'file_list': file_list,
'dirent_more': dirent_more,
'more_start': more_start,
'ENABLE_SUB_LIBRARY': settings.ENABLE_SUB_LIBRARY,
}
html = render_to_string('snippets/repo_dirents.html', ctx,