1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 16:52:39 +00:00

(trunk web) #3278 "add sorting by size support to web client" -- fixed.

This commit is contained in:
Charles Kerr 2010-08-08 21:11:20 +00:00
parent ead0ea9800
commit cbf51842c8
4 changed files with 10 additions and 4 deletions

View file

@ -419,6 +419,7 @@
<li id="sort_by_name">Name</li> <li id="sort_by_name">Name</li>
<li id="sort_by_percent_completed">Progress</li> <li id="sort_by_percent_completed">Progress</li>
<li id="sort_by_queue_order">Queue Order</li> <li id="sort_by_queue_order">Queue Order</li>
<li id="sort_by_size">Size</li>
<li id="sort_by_state">State</li> <li id="sort_by_state">State</li>
<li class="separator"></li> <li class="separator"></li>
<li id="reverse_sort_order">Reverse Sort Order</li> <li id="reverse_sort_order">Reverse Sort Order</li>

View file

@ -181,7 +181,6 @@ function tellUser( primaryText, secondaryText )
$("#dialog_body").html("<p><b>" + primaryText + "</b></p><p>" + secondaryText + "</p>" ); $("#dialog_body").html("<p><b>" + primaryText + "</b></p><p>" + secondaryText + "</p>" );
$("#dialog" ).dialog( { $("#dialog" ).dialog( {
title: primaryText, title: primaryText,
show: 'blind',
hide: 'blind', hide: 'blind',
buttons: { 'Close': function() { $(this).dialog('close'); } } buttons: { 'Close': function() { $(this).dialog('close'); } }
}); });
@ -205,7 +204,6 @@ function askUser(dialog_heading, dialog_message, confirm_button_label,
}; };
$("#dialog" ).dialog( { $("#dialog" ).dialog( {
title: dialog_heading, title: dialog_heading,
show: 'blind',
hide: 'blind', hide: 'blind',
buttons: myButtons buttons: myButtons
}); });
@ -242,6 +240,7 @@ Prefs._SortByActivity = 'activity';
Prefs._SortByQueue = 'queue_order'; Prefs._SortByQueue = 'queue_order';
Prefs._SortByName = 'name'; Prefs._SortByName = 'name';
Prefs._SortByProgress = 'percent_completed'; Prefs._SortByProgress = 'percent_completed';
Prefs._SortBySize = 'size';
Prefs._SortByState = 'state'; Prefs._SortByState = 'state';
Prefs._SortByTracker = 'tracker'; Prefs._SortByTracker = 'tracker';

View file

@ -781,6 +781,11 @@ Torrent.compareByActivity = function( a, b ) {
return a.activity() - b.activity(); return a.activity() - b.activity();
}; };
/** Helper function for sortTorrents(). */
Torrent.compareBySize = function( a, b ) {
return a.size() - b.size();
}
/** Helper function for sortTorrents(). */ /** Helper function for sortTorrents(). */
Torrent.compareByProgress = function( a, b ) { Torrent.compareByProgress = function( a, b ) {
if( a.getPercentDone() !== b.getPercentDone() ) if( a.getPercentDone() !== b.getPercentDone() )
@ -817,6 +822,9 @@ Torrent.sortTorrents = function( torrents, sortMethod, sortDirection )
case Prefs._SortByName: case Prefs._SortByName:
torrents.sort( this.compareByName ); torrents.sort( this.compareByName );
break; break;
case Prefs._SortBySize:
torrents.sort( this.compareBySize );
break;
default: default:
console.warn( "unknown sort method: " + sortMethod ); console.warn( "unknown sort method: " + sortMethod );
break; break;

View file

@ -909,7 +909,6 @@ Transmission.prototype =
resizable: !fullscreen, resizable: !fullscreen,
draggable: !fullscreen, draggable: !fullscreen,
title: 'Preferences', title: 'Preferences',
show: 'blind',
hide: 'blind', hide: 'blind',
buttons: { } buttons: { }
}; };
@ -1069,7 +1068,6 @@ Transmission.prototype =
tr.togglePeriodicStatsRefresh(true); tr.togglePeriodicStatsRefresh(true);
$("#stats_dialog" ).dialog( { $("#stats_dialog" ).dialog( {
title: 'Statistics', title: 'Statistics',
show: 'blind',
hide: 'blind', hide: 'blind',
width: 200, width: 200,
buttons: { buttons: {