re-setup repolist after longpoll refresh

This commit is contained in:
Joey Hess 2013-03-14 14:50:44 -04:00
parent 7289f92522
commit f3c999062d
2 changed files with 28 additions and 20 deletions

View file

@ -3,12 +3,15 @@
connfails=0; connfails=0;
longpollcallbacks = $.Callbacks();
function longpoll(url, divid, cont, fail) { function longpoll(url, divid, cont, fail) {
$.ajax({ $.ajax({
'url': url, 'url': url,
'dataType': 'html', 'dataType': 'html',
'success': function(data, status, jqxhr) { 'success': function(data, status, jqxhr) {
$('#' + divid).replaceWith(data); $('#' + divid).replaceWith(data);
longpollcallbacks.fire();
connfails=0; connfails=0;
cont(); cont();
}, },

View file

@ -1,22 +1,27 @@
$(function() { $(function() {
$("#costsortable").sortable({ var setup = function() {
handle: ".handle", $("#costsortable").sortable({
cursor: "move", handle: ".handle",
forceHelperSize: true, cursor: "move",
start: function(event, ui) { forceHelperSize: true,
ui.item.children(".draghide").hide(); start: function(event, ui) {
}, ui.item.children(".draghide").hide();
stop: function(event, ui) { },
ui.item.children(".draghide").show(); stop: function(event, ui) {
var list = $("#costsortable").sortable("toArray"); ui.item.children(".draghide").show();
var moved = ui.item.attr("id"); var list = $("#costsortable").sortable("toArray");
$.ajax({ var moved = ui.item.attr("id");
'url': "@{RepositoriesReorderR}", $.ajax({
'data': { 'url': "@{RepositoriesReorderR}",
'moved': moved, 'data': {
'list': list 'moved': moved,
} 'list': list
}); }
}, });
}); },
});
};
longpollcallbacks.add(setup);
setup();
}); });