From 9ca47a63d29cd88fda7109e0d7cd0ff05671161c Mon Sep 17 00:00:00 2001 From: OldHawk Date: Fri, 26 Jan 2018 13:19:58 +0800 Subject: [PATCH] feat(core): torrents global search at home --- modules/core/client/app/trans-string-en.js | 3 + modules/core/client/app/trans-string-zh.js | 3 + .../controllers/home.client.controller.js | 2 +- .../controllers/forums.server.controller.js | 3 - .../client/config/torrents.client.routes.js | 7 + .../controllers/torrents.client.controller.js | 13 +- .../views/search-torrents.client.view.html | 277 ++++++++++++++++++ 7 files changed, 302 insertions(+), 6 deletions(-) create mode 100644 modules/torrents/client/views/search-torrents.client.view.html diff --git a/modules/core/client/app/trans-string-en.js b/modules/core/client/app/trans-string-en.js index e1f27de7..47d3409c 100644 --- a/modules/core/client/app/trans-string-en.js +++ b/modules/core/client/app/trans-string-en.js @@ -190,6 +190,7 @@ OTHER_LIST: 'Other List', ADULT_LIST: 'Adult List', TORRENT_INFO: 'Torrent Info', + TORRENT_SEARCH: 'Torrent Search', RANKING: 'Users Ranking', RULES: 'User Rules', BLACK: 'Client Black List', @@ -295,6 +296,7 @@ LIST_PAGE_INFO_ERROR: 'Get resources page info failed', LIST_PAGE_INFO_EMPTY: 'No resources founded, please change some new tags to research', TAGS_SEARCH: 'Tags Search', + TAGS_SEARCH_GLOBAL: 'Tags Search - Global', CA_KEYWORD: 'Keyword', CA_TORRENT_STATUS: 'Torrent status', CA_TORRENT_HNR: 'Hit and Run', @@ -515,6 +517,7 @@ USERS_LIST: 'Users', USERS_UPDATE: 'Update', TORRENT_TYPE_OPTION_NEWEST: 'All Newest Torrents', + TORRENT_TYPE_ALL: 'All Torrents', TORRENT_STATUS_NEW: 'NEW', TORRENT_STATUS_REVIEWED: 'REVIEWED', TORRENT_STATUS_DELETED: 'DELETED', diff --git a/modules/core/client/app/trans-string-zh.js b/modules/core/client/app/trans-string-zh.js index 49335579..61a5deca 100644 --- a/modules/core/client/app/trans-string-zh.js +++ b/modules/core/client/app/trans-string-zh.js @@ -190,6 +190,7 @@ OTHER_LIST: '其它资源列表', ADULT_LIST: '成人资源列表', TORRENT_INFO: '种子信息', + TORRENT_SEARCH: '种子搜索', RANKING: '用户排行榜', RULES: '用户规则', BLACK: '禁止客户端列表', @@ -295,6 +296,7 @@ LIST_PAGE_INFO_ERROR: '获取资源分页列表失败', LIST_PAGE_INFO_EMPTY: '没有找到信息,请更换标签重新检索', TAGS_SEARCH: '标签检索', + TAGS_SEARCH_GLOBAL: '种子搜索 - 全局', CA_KEYWORD: '关键字', CA_TORRENT_STATUS: '种子状态', CA_TORRENT_HNR: 'Hit and Run', @@ -515,6 +517,7 @@ USERS_LIST: '用户列表', USERS_UPDATE: '修改', TORRENT_TYPE_OPTION_NEWEST: '所有未审核的种子', + TORRENT_TYPE_ALL: '所有种子', TORRENT_STATUS_NEW: '未审核', TORRENT_STATUS_REVIEWED: '已审核', TORRENT_STATUS_DELETED: '已删除', diff --git a/modules/core/client/controllers/home.client.controller.js b/modules/core/client/controllers/home.client.controller.js index 85ae477b..a11d534b 100644 --- a/modules/core/client/controllers/home.client.controller.js +++ b/modules/core/client/controllers/home.client.controller.js @@ -45,7 +45,7 @@ $state.go('forums.search', {forumId: fid, keys: vm.searchKeys}); } else { //search from torrents - + $state.go('torrents.search', {keys: vm.searchKeys}); } } }; diff --git a/modules/forums/server/controllers/forums.server.controller.js b/modules/forums/server/controllers/forums.server.controller.js index 40d7bf0c..0a22dd4b 100644 --- a/modules/forums/server/controllers/forums.server.controller.js +++ b/modules/forums/server/controllers/forums.server.controller.js @@ -41,9 +41,6 @@ exports.list = function (req, res) { condition.vipOnly = false; } - console.log('------------------------condition------------------------'); - console.log(condition); - var findForumsList = function (callback) { Forum.find(condition) .sort('category order -createdat') diff --git a/modules/torrents/client/config/torrents.client.routes.js b/modules/torrents/client/config/torrents.client.routes.js index 30ba5d2e..67255ca5 100644 --- a/modules/torrents/client/config/torrents.client.routes.js +++ b/modules/torrents/client/config/torrents.client.routes.js @@ -44,6 +44,13 @@ }); $stateProvider + .state('torrents.search', { + url: '/search?keys', + templateUrl: '/modules/torrents/client/views/search-torrents.client.view.html', + data: { + pageTitle: 'PAGETITLE.TORRENT_SEARCH' + } + }) .state('torrents.view', { url: '/:torrentId', templateUrl: '/modules/torrents/client/views/view-torrent.client.view.html', diff --git a/modules/torrents/client/controllers/torrents.client.controller.js b/modules/torrents/client/controllers/torrents.client.controller.js index 73953fc1..403a4bab 100644 --- a/modules/torrents/client/controllers/torrents.client.controller.js +++ b/modules/torrents/client/controllers/torrents.client.controller.js @@ -22,15 +22,16 @@ vm.torrentSalesType = MeanTorrentConfig.meanTorrentConfig.torrentSalesType; vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage; vm.appConfig = MeanTorrentConfig.meanTorrentConfig.app; + vm.torrentTypeConfig = MeanTorrentConfig.meanTorrentConfig.torrentType; vm.searchTags = []; - vm.searchKey = ''; + vm.searchKey = $state.params.keys || ''; vm.releaseYear = undefined; vm.filterHnR = false; vm.filterSale = false; vm.topItems = 6; - vm.torrentType = $state.current.data.torrentType; + vm.torrentType = $state.current.data.torrentType || 'all'; /** * commentBuildPager @@ -411,5 +412,13 @@ i.removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up'); } }; + + /** + * onTorrentTypeChanged + */ + vm.onTorrentTypeChanged = function () { + vm.searchTags = []; + vm.torrentBuildPager(); + }; } }()); diff --git a/modules/torrents/client/views/search-torrents.client.view.html b/modules/torrents/client/views/search-torrents.client.view.html new file mode 100644 index 00000000..d440eb96 --- /dev/null +++ b/modules/torrents/client/views/search-torrents.client.view.html @@ -0,0 +1,277 @@ +
+
+
+

{{'TAGS_SEARCH_GLOBAL' | translate}}

+
+
+
+
+
{{'CA_RESOURCE_TYPE' | translate}}
+
+
+
+ +
+
+
+ +
{{ 'CA_KEYWORD' | translate}}:
+
+
+
+ +
+
+ + {{ 'MORE_TAGS' | translate}} + + + {{ 'CA_RESET' | translate}} + + +
+
+
+ +
{{ 'CA_TORRENT_HNR' | translate}}:
+
+
+ +
+
+ +
{{ 'CA_TORRENT_SALE_STATUS' | translate}}:
+
+
+ +
+
+ + + +
+
{{'CA_MAKE_RSS_URL' | translate}}:
+
{{'DESC_MAKE_RSS_URL' | translate}} +
+ {{vm.rssUrl}} + + + +
+
+
+
+
+
+
+ +
+
+
    +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
{{ 'TABLE_FIELDS.INFO' | translate}} + {{ 'TABLE_FIELDS.VOTES' | translate}} + + + {{ 'TABLE_FIELDS.LIFETIME' | translate}} + + + {{ 'TABLE_FIELDS.SIZE' | translate}} + + + + {{ 'TABLE_FIELDS.PUBLISHER' | translate}}
+
+
+ {{vm.TGI.getTorrentTitle(item)}} + +
+ +
+
+
+
+ {{vm.TGI.getTorrentDoubleTitle(item)}} +
+ +
+ {{t.name}} +
+ +
{{item.resource_detail_info.subtitle}}
+
{{item.torrent_filename | filename}}
+ +
+ + + {{'TORRENT_TYPE_LABEL.' + item.torrent_type.toUpperCase() | translate}} + + + {{ item.resource_detail_info.release_date}} + + + {{ 'TORRENT_RECOMMEND_LEVEL_ITEM.' + item.torrent_recommended.toUpperCase() | translate}} + + + {{item.torrent_sale_status}} {{item.torrent_sale_expires | unlife}} + + + S{{item.torrent_seasons}}E{{item.torrent_episodes}} + + H&R + + VIP + + + + {{ 'RESOURCESTAGS.' + vm.RTS.getTagTitle(t) + '.' + t.toUpperCase() | translate}} + + +
+
+
+
+ {{vm.TGI.getVoteTitle(item)}} {{item.resource_detail_info.vote_average | number : 1}} + {{item.createdat | life}}{{item.torrent_size | bytes:2}} + + {{ 'ANONYMOUS' | translate }} + +
+ + +
+
+
+
+ +
+
    +
+
+
+
\ No newline at end of file