1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/ad184add11f3/ changeset: r5592:ad184add11f3 user: jgoecks date: 2011-05-22 23:54:01 summary: When adding tracks to Trackster, add them in the order that they appear in the dataset listing. affected #: 1 file (1.2 KB)
--- a/templates/tracks/browser.mako Fri May 20 16:04:30 2011 -0400 +++ b/templates/tracks/browser.mako Sun May 22 23:54:01 2011 +0200 @@ -178,6 +178,7 @@ hide_modal(); }, "Insert": function() { + var requests = []; $('input[name=id]:checked,input[name=ldda_ids]:checked').each(function() { var data, id = $(this).val(); @@ -186,13 +187,25 @@ } else { data = { ldda_id: id}; } - $.ajax( { - url: "${h.url_for( action='add_track_async' )}", - data: data, - dataType: "json", - success: add_async_success - }); - + requests[requests.length] = $.ajax({ + url: "${h.url_for( action='add_track_async' )}", + data: data, + dataType: "json", + }); + }); + // To preserve order, wait until there are definitions for all tracks and then add + // them sequentially. + $.when.apply($, requests).then(function() { + // jQuery always returns an Array for arguments, so need to look at first element + // to determine whether multiple requests were made and consequently how to + // map arguments to track definitions. + var track_defs = (arguments[0] instanceof Array ? + $.map(arguments, function(arg) { return arg[0]; }) : + [ arguments[0] ] + ); + for (var i= 0; i < track_defs.length; i++) { + add_async_success(track_defs[i]); + } }); hide_modal(); }
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
galaxy-commits@lists.galaxyproject.org