From c0063d7e0141dc594432e56d8b07cb4483c2ac60 Mon Sep 17 00:00:00 2001 From: OldHawk Date: Wed, 6 Dec 2017 16:27:31 +0800 Subject: [PATCH] feat(torrents): Add an orderBy function for "Life" and "Size" #20 --- .../controllers/about.client.controller.js | 42 +++++++++++++++++++ .../client/views/maker-view.client.view.html | 14 ++++++- modules/core/client/app/trans-string-en.js | 2 + modules/core/client/app/trans-string-zh.js | 2 + .../controllers/torrents.client.controller.js | 42 +++++++++++++++++++ .../views/list-torrents.client.view.html | 14 ++++++- .../controllers/vip.client.controller.js | 42 +++++++++++++++++++ modules/vip/client/views/vip.client.view.html | 14 ++++++- 8 files changed, 166 insertions(+), 6 deletions(-) diff --git a/modules/about/client/controllers/about.client.controller.js b/modules/about/client/controllers/about.client.controller.js index 40434be7..7e369c1b 100644 --- a/modules/about/client/controllers/about.client.controller.js +++ b/modules/about/client/controllers/about.client.controller.js @@ -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'; diff --git a/modules/about/client/views/maker-view.client.view.html b/modules/about/client/views/maker-view.client.view.html index 95734800..154da1be 100644 --- a/modules/about/client/views/maker-view.client.view.html +++ b/modules/about/client/views/maker-view.client.view.html @@ -133,8 +133,18 @@ uib-tooltip="{{ 'TABLE_FIELDS.TITLE_VOTES' | translate}}">{{ 'TABLE_FIELDS.VOTES' | translate}} - {{ 'TABLE_FIELDS.LIFETIME' | translate}} - {{ 'TABLE_FIELDS.SIZE' | translate}} + + {{ 'TABLE_FIELDS.LIFETIME' | translate}} + + + + {{ 'TABLE_FIELDS.SIZE' | translate}} + + {{ 'TABLE_FIELDS.VOTES' | translate}} - {{ 'TABLE_FIELDS.LIFETIME' | translate}} - {{ 'TABLE_FIELDS.SIZE' | translate}} + + {{ 'TABLE_FIELDS.LIFETIME' | translate}} + + + + {{ 'TABLE_FIELDS.SIZE' | translate}} + + {{ 'TABLE_FIELDS.VOTES' | translate}} - {{ 'TABLE_FIELDS.LIFETIME' | translate}} - {{ 'TABLE_FIELDS.SIZE' | translate}} + + {{ 'TABLE_FIELDS.LIFETIME' | translate}} + + + + {{ 'TABLE_FIELDS.SIZE' | translate}} + +