From d69e4ebfb9697438b01e8f75e484e2541ccd3d07 Mon Sep 17 00:00:00 2001 From: OldHawk Date: Sun, 3 Dec 2017 12:38:50 +0800 Subject: [PATCH] feat(torrents): add sale filter on torrent list page and admin list page to list all sale now torrents --- modules/core/client/app/trans-string-en.js | 2 ++ modules/core/client/app/trans-string-zh.js | 2 ++ .../admin/admin-list.client.controller.js | 14 +++++++++++++- .../controllers/torrents.client.controller.js | 16 ++++++++++++++-- .../views/admin/admin-list.client.view.html | 11 ++++++++++- .../client/views/list-torrents.client.view.html | 11 ++++++++++- .../controllers/torrents.server.controller.js | 9 +++++++++ 7 files changed, 60 insertions(+), 5 deletions(-) diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index bb617c89..ed0881ca 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -255,6 +255,8 @@ CA_KEYWORD: 'Keyword', CA_TORRENT_STATUS: 'Torrent status', CA_TORRENT_HNR: 'Hit and Run', + CA_TORRENT_SALE_STATUS: 'Sale Status', + CA_TORRENT_SALE_NOW: 'Sale now', CA_TORRENT_VIP: 'VIP resources', CA_RESOURCE_TYPE: 'Resource type', PH_KEYWORD: 'Search keyword', diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index 230ec73b..18c2a075 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -255,6 +255,8 @@ CA_KEYWORD: '关键字', CA_TORRENT_STATUS: '种子状态', CA_TORRENT_HNR: 'Hit and Run', + CA_TORRENT_SALE_STATUS: '促销状态', + CA_TORRENT_SALE_NOW: '正在促销', CA_TORRENT_VIP: 'VIP 资源', CA_RESOURCE_TYPE: '资源类型', PH_KEYWORD: '搜索关键字', diff --git a/modules/torrents/client/controllers/admin/admin-list.client.controller.js b/modules/torrents/client/controllers/admin/admin-list.client.controller.js index 21a0f65f..57d66306 100644 --- a/modules/torrents/client/controllers/admin/admin-list.client.controller.js +++ b/modules/torrents/client/controllers/admin/admin-list.client.controller.js @@ -186,7 +186,8 @@ torrent_release: vm.releaseYear, torrent_tags: vm.searchTags, torrent_hnr: vm.filterHnR, - torrent_vip: vm.filterVIP + torrent_vip: vm.filterVIP, + torrent_sale: vm.filterSale }, function (items) { if (items.length === 0) { Notification.error({ @@ -248,6 +249,17 @@ vm.torrentBuildPager(); }; + /** + * onSaleChanged + */ + vm.onSaleClicked = function () { + vm.filterSale = !vm.filterSale; + vm.torrentBuildPager(); + }; + vm.onSaleChanged = function () { + vm.torrentBuildPager(); + }; + /** * onVIPClicked, onVIPChanged */ diff --git a/modules/torrents/client/controllers/torrents.client.controller.js b/modules/torrents/client/controllers/torrents.client.controller.js index 11abe99c..d3cf341d 100644 --- a/modules/torrents/client/controllers/torrents.client.controller.js +++ b/modules/torrents/client/controllers/torrents.client.controller.js @@ -242,7 +242,7 @@ vm.getResourcePageInfo = function (p, callback) { //if searchKey or searchTags has value, the skip=0 var skip = vm.topItems; - if (vm.searchKey.trim().length > 0 || vm.searchTags.length > 0 || vm.releaseYear || vm.filterHnR || vm.sort) { + if (vm.searchKey.trim().length > 0 || vm.searchTags.length > 0 || vm.releaseYear || vm.filterHnR || vm.filterSale || vm.sort) { skip = 0; } @@ -255,7 +255,8 @@ torrent_type: vm.torrentType, torrent_release: vm.releaseYear, torrent_tags: vm.searchTags, - torrent_hnr: vm.filterHnR + torrent_hnr: vm.filterHnR, + torrent_sale: vm.filterSale }, function (items) { if (items.length === 0) { Notification.error({ @@ -319,6 +320,17 @@ vm.torrentBuildPager(); }; + /** + * onSaleChanged + */ + vm.onSaleClicked = function () { + vm.filterSale = !vm.filterSale; + vm.torrentBuildPager(); + }; + vm.onSaleChanged = function () { + vm.torrentBuildPager(); + }; + /** * onMoreTagsClicked */ diff --git a/modules/torrents/client/views/admin/admin-list.client.view.html b/modules/torrents/client/views/admin/admin-list.client.view.html index 95762aa0..2d0c6ce3 100644 --- a/modules/torrents/client/views/admin/admin-list.client.view.html +++ b/modules/torrents/client/views/admin/admin-list.client.view.html @@ -54,6 +54,15 @@ +
{{ 'CA_TORRENT_SALE_STATUS' | translate}}:
+
+
+ +
+
+
{{ 'CA_TORRENT_VIP' | translate}}:
@@ -210,7 +219,7 @@ {{item.torrent_sale_status}} {{item.torrent_sale_expires | unlife}} diff --git a/modules/torrents/client/views/list-torrents.client.view.html b/modules/torrents/client/views/list-torrents.client.view.html index 627951e2..727145c6 100644 --- a/modules/torrents/client/views/list-torrents.client.view.html +++ b/modules/torrents/client/views/list-torrents.client.view.html @@ -98,6 +98,15 @@
+
{{ 'CA_TORRENT_SALE_STATUS' | translate}}:
+
+
+ +
+
+