mirror of
https://github.com/transmission/transmission
synced 2024-12-23 08:13:27 +00:00
(trunk web) #4637 "sorting by size in the web ui" -- patch added.
This commit is contained in:
parent
788b1f20a7
commit
2d4d29793c
3 changed files with 17 additions and 1 deletions
|
@ -360,8 +360,9 @@
|
||||||
<li class='sort-mode' id="sort_by_activity">Activity</li>
|
<li class='sort-mode' id="sort_by_activity">Activity</li>
|
||||||
<li class='sort-mode' id="sort_by_age">Age</li>
|
<li class='sort-mode' id="sort_by_age">Age</li>
|
||||||
<li class='sort-mode' id="sort_by_name">Name</li>
|
<li class='sort-mode' id="sort_by_name">Name</li>
|
||||||
<li class='sort-mode' id="sort_by_percent_completed">Progress</li>
|
|
||||||
<li class='sort-mode' id="sort_by_ratio">Ratio</li>
|
<li class='sort-mode' id="sort_by_ratio">Ratio</li>
|
||||||
|
<li class='sort-mode' id="sort_by_size">Size</li>
|
||||||
|
<li class='sort-mode' id="sort_by_percent_completed">Progress</li>
|
||||||
<li class='sort-mode' id="sort_by_queue_order">Queue Order</li>
|
<li class='sort-mode' id="sort_by_queue_order">Queue Order</li>
|
||||||
<li class='sort-mode' id="sort_by_state">State</li>
|
<li class='sort-mode' id="sort_by_state">State</li>
|
||||||
<li class="separator"></li>
|
<li class="separator"></li>
|
||||||
|
|
|
@ -157,6 +157,7 @@ Prefs._SortByAge = 'age';
|
||||||
Prefs._SortByActivity = 'activity';
|
Prefs._SortByActivity = 'activity';
|
||||||
Prefs._SortByName = 'name';
|
Prefs._SortByName = 'name';
|
||||||
Prefs._SortByQueue = 'queue_order';
|
Prefs._SortByQueue = 'queue_order';
|
||||||
|
Prefs._SortBySize = 'size';
|
||||||
Prefs._SortByProgress = 'percent_completed';
|
Prefs._SortByProgress = 'percent_completed';
|
||||||
Prefs._SortByRatio = 'ratio';
|
Prefs._SortByRatio = 'ratio';
|
||||||
Prefs._SortByState = 'state';
|
Prefs._SortByState = 'state';
|
||||||
|
|
|
@ -408,6 +408,14 @@ Torrent.compareByProgress = function(ta, tb)
|
||||||
return (a - b) || Torrent.compareByRatio(ta, tb);
|
return (a - b) || Torrent.compareByRatio(ta, tb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Torrent.compareBySize = function(ta, tb)
|
||||||
|
{
|
||||||
|
var a = ta.getTotalSize(),
|
||||||
|
b = tb.getTotalSize();
|
||||||
|
|
||||||
|
return (a - b) || Torrent.compareByName(ta, tb);
|
||||||
|
}
|
||||||
|
|
||||||
Torrent.compareTorrents = function(a, b, sortMethod, sortDirection)
|
Torrent.compareTorrents = function(a, b, sortMethod, sortDirection)
|
||||||
{
|
{
|
||||||
var i;
|
var i;
|
||||||
|
@ -426,6 +434,9 @@ Torrent.compareTorrents = function(a, b, sortMethod, sortDirection)
|
||||||
case Prefs._SortByProgress:
|
case Prefs._SortByProgress:
|
||||||
i = Torrent.compareByProgress(a,b);
|
i = Torrent.compareByProgress(a,b);
|
||||||
break;
|
break;
|
||||||
|
case Prefs._SortBySize:
|
||||||
|
i = Torrent.compareBySize(a,b);
|
||||||
|
break;
|
||||||
case Prefs._SortByState:
|
case Prefs._SortByState:
|
||||||
i = Torrent.compareByState(a,b);
|
i = Torrent.compareByState(a,b);
|
||||||
break;
|
break;
|
||||||
|
@ -464,6 +475,9 @@ Torrent.sortTorrents = function(torrents, sortMethod, sortDirection)
|
||||||
case Prefs._SortByProgress:
|
case Prefs._SortByProgress:
|
||||||
torrents.sort(this.compareByProgress);
|
torrents.sort(this.compareByProgress);
|
||||||
break;
|
break;
|
||||||
|
case Prefs._SortBySize:
|
||||||
|
torrents.sort(this.compareBySize);
|
||||||
|
break;
|
||||||
case Prefs._SortByState:
|
case Prefs._SortByState:
|
||||||
torrents.sort(this.compareByState);
|
torrents.sort(this.compareByState);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue