1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-23 09:11:15 +00:00
seahub/templates/snippets/events_js.html

64 lines
2.5 KiB
HTML
Raw Normal View History

2012-12-19 11:06:38 +00:00
{% load i18n %}
2013-01-12 08:33:32 +00:00
{% include 'snippets/list_commit_detail.html' %}
2012-12-19 11:06:38 +00:00
function reqEvents(start) {
$('#events-loading').removeClass('hide');
$.ajax({
url:'{{SITE_ROOT}}events/?start=' + start{% if org %} + '&org_id={{ org.org_id }}'{% endif %},
dataType: 'json',
cache: false,
success: function(data) {
$('#events').append(data['html']);
$('.event-item').each(function(index) {
if (index > 0 && $(this).children('.pic').attr('data') == $(this).prev().children('.pic').attr('data')) {
$(this).children('.pic').addClass('hide');
}
});
if (start == 0) {
$('#events').removeClass('hide');
}
$('#events-loading').addClass('hide');
if (data['more']) {
$('#events-more').data('start', start + 10).removeClass('hide');
} else {
$('#events-more').addClass('hide');
}
if ($.browser.mozilla || $.browser.msie) {
$('#events a').focus(function() {
$(this).blur();
});
}
2013-01-12 08:33:32 +00:00
$('.lsch').click(function() {
listCommitDetails($(this).data('url'), $(this).data('time'));
return false;
});
2013-01-11 08:41:40 +00:00
$('.lsch-encrypted').click(function() {
2012-12-19 11:06:38 +00:00
if ($(this).data('passwordset')) {
2013-01-12 08:33:32 +00:00
listCommitDetails($(this).data('url'), $(this).data('time'));
2012-12-19 11:06:38 +00:00
} else {
2013-01-11 08:41:40 +00:00
var form = $('#repo-decrypt-form');
form.find('input[name="repo_id"]').val($(this).data('repoid'));
form.find('.op-target').html($(this).data('reponame'));
2013-01-12 08:33:32 +00:00
form.data({'url':$(this).data('url'), 'time':$(this).data('time')}).modal({appendTo:'#main'});
2012-12-19 11:06:38 +00:00
}
return false;
});
},
error: function() {
2013-01-11 08:41:40 +00:00
var str = '{% trans "Unknown error." %} ';
2012-12-19 11:06:38 +00:00
if ($('#events-more').hasClass('hide')) {
str += '{% trans "Please refresh the page later." %}';
} else {
str += '{% trans "Please try again later." %}';
}
$('#events-loading').addClass('hide');
2012-12-19 11:06:38 +00:00
$('#events-error').html(str).removeClass('hide');
}
});
}
reqEvents(0);
$('#events-more').click(function() {
$(this).addClass('hide');
reqEvents($(this).data('start'));
});
{% include 'snippets/repo_decrypt_js.html' %}