feat(torrents): Add an orderBy function for "Life" and "Size"

#20
This commit is contained in:
OldHawk
2017-12-06 16:27:31 +08:00
parent 67208756f0
commit c0063d7e01
8 changed files with 166 additions and 6 deletions

View File

@@ -70,6 +70,8 @@
*/
vm.orderByVote = function () {
vm.sortSLF = undefined;
vm.sortSize = undefined;
vm.sortLife = undefined;
if (vm.sortVote === undefined) {
vm.sortVote = '-';
@@ -82,11 +84,51 @@
vm.buildPager();
};
/**
* orderBySize
*/
vm.orderBySize = function () {
vm.sortSLF = undefined;
vm.sortVote = undefined;
vm.sortLife = undefined;
if (vm.sortSize === undefined) {
vm.sortSize = '-';
vm.sort = {'torrent_size': -1};
} else if (vm.sortSize === '-') {
vm.sortSize = undefined;
vm.sort = undefined;
}
vm.buildPager();
};
/**
* orderByLife
*/
vm.orderByLife = function () {
vm.sortSLF = undefined;
vm.sortVote = undefined;
vm.sortSize = undefined;
if (vm.sortLife === undefined) {
vm.sortLife = '-';
vm.sort = {'createdat': 1};
} else if (vm.sortLife === '-') {
vm.sortLife = undefined;
vm.sort = undefined;
}
vm.buildPager();
};
/**
* orderBySLF
*/
vm.orderBySLF = function () {
vm.sortVote = undefined;
vm.sortSize = undefined;
vm.sortLife = undefined;
if (vm.sortSLF === undefined) {
vm.sortSLF = '-S';

View File

@@ -133,8 +133,18 @@
uib-tooltip="{{ 'TABLE_FIELDS.TITLE_VOTES' | translate}}">{{ 'TABLE_FIELDS.VOTES' | translate}}</a>
<i class="fa fa-caret-down text-info" ng-if="vm.sortVote == '-'"></i>
</th>
<th class="text-center">{{ 'TABLE_FIELDS.LIFETIME' | translate}}</th>
<th class="text-center">{{ 'TABLE_FIELDS.SIZE' | translate}}</th>
<th class="text-center">
<a href="#" tooltip-placement="top"
ng-click="vm.orderByLife();"
uib-tooltip="{{ 'TABLE_FIELDS.TITLE_LIFE' | translate}}">{{ 'TABLE_FIELDS.LIFETIME' | translate}}</a>
<i class="fa fa-caret-down text-info" ng-if="vm.sortLife == '-'"></i>
</th>
<th class="text-center">
<a href="#" tooltip-placement="top"
ng-click="vm.orderBySize();"
uib-tooltip="{{ 'TABLE_FIELDS.TITLE_SIZE' | translate}}">{{ 'TABLE_FIELDS.SIZE' | translate}}</a>
<i class="fa fa-caret-down text-info" ng-if="vm.sortSize == '-'"></i>
</th>
<th>
<a href="#" tooltip-placement="top"
ng-click="vm.orderBySLF();"

View File

@@ -111,6 +111,8 @@
LIFETIME: 'Life',
VOTES: 'Votes',
TITLE_VOTES: 'orderBy votes',
TITLE_SIZE: 'orderBy size',
TITLE_LIFE: 'orderBy life',
//status
UPLOADED_SPEED: 'U/S',

View File

@@ -111,6 +111,8 @@
LIFETIME: '存活时间',
VOTES: '评分',
TITLE_VOTES: '按评分排序',
TITLE_SIZE: '按文件大小排序',
TITLE_LIFE: '按上传时间排序',
//status
UPLOADED_SPEED: '上/速',

View File

@@ -153,6 +153,8 @@
*/
vm.orderByVote = function () {
vm.sortSLF = undefined;
vm.sortSize = undefined;
vm.sortLife = undefined;
if (vm.sortVote === undefined) {
vm.sortVote = '-';
@@ -165,11 +167,51 @@
vm.torrentBuildPager();
};
/**
* orderBySize
*/
vm.orderBySize = function () {
vm.sortSLF = undefined;
vm.sortVote = undefined;
vm.sortLife = undefined;
if (vm.sortSize === undefined) {
vm.sortSize = '-';
vm.sort = {'torrent_size': -1};
} else if (vm.sortSize === '-') {
vm.sortSize = undefined;
vm.sort = undefined;
}
vm.torrentBuildPager();
};
/**
* orderByLife
*/
vm.orderByLife = function () {
vm.sortSLF = undefined;
vm.sortVote = undefined;
vm.sortSize = undefined;
if (vm.sortLife === undefined) {
vm.sortLife = '-';
vm.sort = {'createdat': 1};
} else if (vm.sortLife === '-') {
vm.sortLife = undefined;
vm.sort = undefined;
}
vm.torrentBuildPager();
};
/**
* orderBySLF
*/
vm.orderBySLF = function () {
vm.sortVote = undefined;
vm.sortSize = undefined;
vm.sortLife = undefined;
if (vm.sortSLF === undefined) {
vm.sortSLF = '-S';

View File

@@ -163,8 +163,18 @@
uib-tooltip="{{ 'TABLE_FIELDS.TITLE_VOTES' | translate}}">{{ 'TABLE_FIELDS.VOTES' | translate}}</a>
<i class="fa fa-caret-down text-info" ng-if="vm.sortVote == '-'"></i>
</th>
<th class="text-center">{{ 'TABLE_FIELDS.LIFETIME' | translate}}</th>
<th class="text-center">{{ 'TABLE_FIELDS.SIZE' | translate}}</th>
<th class="text-center">
<a href="#" tooltip-placement="top"
ng-click="vm.orderByLife();"
uib-tooltip="{{ 'TABLE_FIELDS.TITLE_LIFE' | translate}}">{{ 'TABLE_FIELDS.LIFETIME' | translate}}</a>
<i class="fa fa-caret-down text-info" ng-if="vm.sortLife == '-'"></i>
</th>
<th class="text-center">
<a href="#" tooltip-placement="top"
ng-click="vm.orderBySize();"
uib-tooltip="{{ 'TABLE_FIELDS.TITLE_SIZE' | translate}}">{{ 'TABLE_FIELDS.SIZE' | translate}}</a>
<i class="fa fa-caret-down text-info" ng-if="vm.sortSize == '-'"></i>
</th>
<th>
<a href="#" tooltip-placement="top"
ng-click="vm.orderBySLF();"

View File

@@ -66,6 +66,8 @@
*/
vm.orderByVote = function () {
vm.sortSLF = undefined;
vm.sortSize = undefined;
vm.sortLife = undefined;
if (vm.sortVote === undefined) {
vm.sortVote = '-';
@@ -78,11 +80,51 @@
vm.buildPager();
};
/**
* orderBySize
*/
vm.orderBySize = function () {
vm.sortSLF = undefined;
vm.sortVote = undefined;
vm.sortLife = undefined;
if (vm.sortSize === undefined) {
vm.sortSize = '-';
vm.sort = {'torrent_size': -1};
} else if (vm.sortSize === '-') {
vm.sortSize = undefined;
vm.sort = undefined;
}
vm.buildPager();
};
/**
* orderByLife
*/
vm.orderByLife = function () {
vm.sortSLF = undefined;
vm.sortVote = undefined;
vm.sortSize = undefined;
if (vm.sortLife === undefined) {
vm.sortLife = '-';
vm.sort = {'createdat': 1};
} else if (vm.sortLife === '-') {
vm.sortLife = undefined;
vm.sort = undefined;
}
vm.buildPager();
};
/**
* orderBySLF
*/
vm.orderBySLF = function () {
vm.sortVote = undefined;
vm.sortSize = undefined;
vm.sortLife = undefined;
if (vm.sortSLF === undefined) {
vm.sortSLF = '-S';

View File

@@ -154,8 +154,18 @@
uib-tooltip="{{ 'TABLE_FIELDS.TITLE_VOTES' | translate}}">{{ 'TABLE_FIELDS.VOTES' | translate}}</a>
<i class="fa fa-caret-down text-info" ng-if="vm.sortVote == '-'"></i>
</th>
<th class="text-center">{{ 'TABLE_FIELDS.LIFETIME' | translate}}</th>
<th class="text-center">{{ 'TABLE_FIELDS.SIZE' | translate}}</th>
<th class="text-center">
<a href="#" tooltip-placement="top"
ng-click="vm.orderByLife();"
uib-tooltip="{{ 'TABLE_FIELDS.TITLE_LIFE' | translate}}">{{ 'TABLE_FIELDS.LIFETIME' | translate}}</a>
<i class="fa fa-caret-down text-info" ng-if="vm.sortLife == '-'"></i>
</th>
<th class="text-center">
<a href="#" tooltip-placement="top"
ng-click="vm.orderBySize();"
uib-tooltip="{{ 'TABLE_FIELDS.TITLE_SIZE' | translate}}">{{ 'TABLE_FIELDS.SIZE' | translate}}</a>
<i class="fa fa-caret-down text-info" ng-if="vm.sortSize == '-'"></i>
</th>
<th>
<a href="#" tooltip-placement="top"
ng-click="vm.orderBySLF();"