feat(core): torrents global search at home

This commit is contained in:
OldHawk
2018-01-26 13:19:58 +08:00
parent 26fd37439c
commit 9ca47a63d2
7 changed files with 302 additions and 6 deletions

View File

@@ -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',

View File

@@ -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: '已删除',

View File

@@ -45,7 +45,7 @@
$state.go('forums.search', {forumId: fid, keys: vm.searchKeys});
} else { //search from torrents
$state.go('torrents.search', {keys: vm.searchKeys});
}
}
};

View File

@@ -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')

View File

@@ -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',

View File

@@ -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();
};
}
}());

View File

@@ -0,0 +1,277 @@
<section class="container padding-top-10" ng-controller="TorrentsController as vm" ng-init="vm.torrentBuildPager();">
<div class="panel panel-default">
<div class="panel-heading text-center">
<h3 class="panel-title">{{'TAGS_SEARCH_GLOBAL' | translate}}</h3>
</div>
<div class="panel-body">
<div class="col-md-10 col-md-offset-1">
<dl class="dl-horizontal">
<dt class="h-line">{{'CA_RESOURCE_TYPE' | translate}}</dt>
<dd class="h-line">
<div class="row margin-bottom-5">
<div class="col-sm-6 col-md-4">
<select class="form-control" ng-model="vm.torrentType" ng-change="vm.onTorrentTypeChanged();">
<option value="all">{{'TORRENT_TYPE_ALL' | translate}}
</option>
<option ng-repeat="t in vm.torrentTypeConfig.value | filter:{enable: true}"
value="{{t.value}}">{{'MENU_TORRENTS_SUB.'+t.name | translate}}
</option>
</select>
</div>
</div>
</dd>
<dt class="h-line">{{ 'CA_KEYWORD' | translate}}:</dt>
<dd class="h-line">
<div class="row" style="">
<div class="col-sm-7">
<input type="text" class="form-control" ng-model="vm.searchKey"
ng-keydown="vm.onKeysKeyDown($event);"
placeholder="{{ 'PH_KEYWORD' | translate}}">
</div>
<div class="col-sm-5">
<span class="label label-tag text-uppercase incline-block-valign"
title="{{ 'TITLE_ALT.MORE_TAGS' | translate}}"
ng-click="vm.onMoreTagsClicked();">
<i class="glyphicon glyphicon-chevron-down" id="more-tags-icon"></i> {{ 'MORE_TAGS' | translate}}
</span>
<span class="label label-tag text-uppercase incline-block-valign"
title="{{ 'TITLE_ALT.RESET_TAGS' | translate}}"
ng-click="vm.clearAllCondition();">
<i class="glyphicon glyphicon-repeat"></i> {{ 'CA_RESET' | translate}}
</span>
</div>
</div>
</dd>
<dt class="h-line">{{ 'CA_TORRENT_HNR' | translate}}:</dt>
<dd class="h-line">
<div class="checkbox checkbox-hnr">
<label>
<input type="checkbox" ng-model="vm.filterHnR" ng-change="vm.onHnRChanged();"> {{ 'CA_TORRENT_HNR' | translate}}
</label>
</div>
</dd>
<dt class="h-line">{{ 'CA_TORRENT_SALE_STATUS' | translate}}:</dt>
<dd class="h-line">
<div class="checkbox checkbox-hnr">
<label>
<input type="checkbox" ng-model="vm.filterSale"
ng-change="vm.onSaleChanged();"> {{ 'CA_TORRENT_SALE_NOW' | translate}}
</label>
</div>
</dd>
<div class="more-tags panel-collapsed" style="display: none; margin-bottom: 20px;">
<div ng-repeat="item in vm.resourcesTags.radio | filter:vm.torrentType">
<dt class="h-line">{{ 'RESOURCESTAGS.'+item.name+'.SELF' | translate}}:</dt>
<dd class="h-line">
<div class="btn-group btn-group-xs" role="group">
<button ng-repeat="sitem in item.value" id="tag_{{sitem.name}}"
class="btn btn-xs btn-default btn-tag" value="{{sitem.name}}"
ng-click="vm.onRadioTagClicked($event, sitem.name)">
{{ 'RESOURCESTAGS.' + item.name + '.' + sitem.name | translate}}
</button>
</span>
</div>
</dd>
</div>
<div style="margin-top: 20px;"></div>
<div ng-repeat="item in vm.resourcesTags.checkbox | filter:vm.torrentType">
<dt class="h-line">{{ 'RESOURCESTAGS.'+item.name+'.SELF' | translate}}:</dt>
<dd class="h-line">
<div class="btn-group btn-group-xs" role="group">
<button ng-repeat="sitem in item.value" id="tag_{{sitem.name}}"
class="btn btn-xs btn-default btn-tag" value="{{sitem.name}}"
ng-click="vm.onCheckboxTagClicked($event, sitem.name)"
toggle-class="btn-success" base-class="btn-default" onclick="this.blur();">
{{ 'RESOURCESTAGS.' + item.name + '.' + sitem.name | translate}}
</button>
</div>
</dd>
</div>
</div>
<div>
<dt class="h-line"><i class="fa fa-rss-square color-mt-base" aria-hidden="true"></i> {{'CA_MAKE_RSS_URL' | translate}}:</dt>
<dd class="h-line rss-desc-line">{{'DESC_MAKE_RSS_URL' | translate}}
<div class="margin-top-5">
<a href="{{vm.rssUrl}}" target="_blank">{{vm.rssUrl}}</a>
<span style="position: relative">
<i class="fa fa-clipboard color-mt-base" aria-hidden="true" title="{{'COPY_TO_CLIPBOARD' | translate}}"
mt-scale-by-click="{scale: 2, duration: '.3s'}"
mt-copy-to-clipboard="{{vm.rssUrl}}"></i>
</span>
</div>
</dd>
</div>
</dl>
</div>
</div>
</div>
<div class="torrent-list" id="top_of_torrent_list">
<div class="pagination-div-top">
<ul uib-pagination boundary-links="true" max-size="8" items-per-page="vm.torrentItemsPerPage" total-items="vm.torrentFilterLength"
ng-model="vm.torrentCurrentPage" ng-change="vm.torrentPageChanged()"
first-text="{{ 'PAGE_TEXT_FIRST' | translate}}" previous-text="{{ 'PAGE_TEXT_PREVIOUS' | translate}}"
next-text="{{ 'PAGE_TEXT_NEXT' | translate}}" last-text="{{ 'PAGE_TEXT_LAST' | translate}}">
</ul>
</div>
<div class="table-responsive">
<table class="table table-hover tb-v-middle">
<thead>
<tr>
<th class="td-width-0"></th>
<th>{{ 'TABLE_FIELDS.INFO' | translate}}</th>
<th>
<a href="#" tooltip-placement="top"
ng-click="vm.orderByVote();"
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">
<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();"
uib-tooltip="{{ 'TABLE_FIELDS.TITLE_SEEDS_LEECHERS_FINISHED' | translate}}" ng-bind-html="vm.getOrderTableHead()"></a>
</th>
<th class="text-center">{{ 'TABLE_FIELDS.PUBLISHER' | translate}}</th>
</tr>
</thead>
<tbody>
<tr class="torrent-list-info" ng-repeat-start="item in vm.torrentPagedItems" ng-click="vm.TGI.openTorrentDetailInfo(item._id);">
<td class="td-width-0" rowspan="2"></td>
<td class="col-md-7 td-text-overflow">
<div class="media">
<div class="media-left">
<img class="media-object" torrent-logo="item"
ng-src="{{vm.TGI.getTorrentListImage(item)}}"
alt="{{vm.TGI.getTorrentTitle(item)}}">
<div class="layer-download" ng-class="{'music': item.torrent_type=='music'}">
<i class="fa fa-arrow-circle-o-down fa-3x" aria-hidden="true"
title="{{ 'TITLE_ALT.DOWNLOAD_TORRENT' | translate}}"
ng-click="vm.DLS.downloadTorrent(item._id); $event.stopPropagation();"
ng-class="{'fa-arrow-circle-down': vm.hover}"
ng-mouseover="vm.hover = true;" ng-mouseleave="vm.hover = false;"></i>
</div>
</div>
<div class="media-body">
<h5 class="media-heading">
<a ui-sref="torrents.view({torrentId: item._id})">{{vm.TGI.getTorrentDoubleTitle(item)}}</a>
</h5>
<div class="list-all-genres">
<span class="genres-item" ng-repeat="t in item.resource_detail_info.genres">{{t.name}}</span>
</div>
<div class="torrent-filename text-long">{{item.resource_detail_info.subtitle}}</div>
<div class="torrent-filename text-long">{{item.torrent_filename | filename}}</div>
<div class="list-all-tags">
<!--<span class="label label-success text-uppercase">{{ item.torrent_type}}</span>-->
<span class="label label-ttype label-primary" ng-click="$event.stopPropagation();"
ng-if="vm.torrentType=='all'">
{{'TORRENT_TYPE_LABEL.' + item.torrent_type.toUpperCase() | translate}}
</span>
<span class="label label-release label-warning" ng-show="item.resource_detail_info.release_date"
ng-click="vm.onReleaseClicked(item.resource_detail_info.release_date); $event.stopPropagation();">
{{ item.resource_detail_info.release_date}}
</span>
<span class="label label-rlevel label-info"
ng-show="item.torrent_recommended != 'none'"
ng-click="$event.stopPropagation();">
{{ 'TORRENT_RECOMMEND_LEVEL_ITEM.' + item.torrent_recommended.toUpperCase() | translate}}
</span>
<span class="label label-sale" ng-if="item.isSaling"
title="{{vm.TGI.getTorrentSaleTypeDesc(item);}} | {{ 'SALE_EXPIRES_TIME' | translate}}: {{item.torrent_sale_expires | date: 'MM-dd HH:mm'}}"
ng-click="vm.onSaleClicked(); $event.stopPropagation();"
ng-class="{'label-default': !item.isSaling, 'label-success': item.isSaling}">
{{item.torrent_sale_status}} {{item.torrent_sale_expires | unlife}}
</span>
<span class="label label-se-info" ng-if="vm.torrentType == 'tvserial'"
ng-click="$event.stopPropagation();">S{{item.torrent_seasons}}E{{item.torrent_episodes}}</span>
<span class="label label-hnr-info" ng-if="item.torrent_hnr"
ng-click="vm.onHnRClicked(); $event.stopPropagation();">H&R</span>
<span class="label label-vip-info" ng-if="item.torrent_vip" ng-class="{'used': vm.filterVIP}"
ng-click="vm.onVIPClicked(); $event.stopPropagation();">VIP</span>
<span ng-repeat="t in item.torrent_tags">
<span class="label label-tag" ng-class="{'used': vm.searchTags.indexOf(t) !== -1}"
ng-click="vm.onTagClicked(t); $event.stopPropagation();"
ng-if="vm.RTS.tagInList(t);">
{{ 'RESOURCESTAGS.' + vm.RTS.getTagTitle(t) + '.' + t.toUpperCase() | translate}}
</span>
</span>
</div>
</div>
</div>
</td>
<td class="col-md-1 td-v-middle td-imdb">
<span title="{{ 'TITLE_ALT.IMDB_VOTES' | translate}}"
class="torrent-votes"><kbd>{{vm.TGI.getVoteTitle(item)}}</kbd> {{item.resource_detail_info.vote_average | number : 1}}</span>
</td>
<td class="col-md-1 td-v-middle text-center td-life">{{item.createdat | life}}</td>
<td class="col-md-1 td-v-middle text-center td-size">{{item.torrent_size | bytes:2}}</td>
<td class="col-md-1 td-v-middle list-user-info td-user-info">
<p class="no-margin-p" title="{{ 'TITLE_ALT.SEEDS' | translate}}">
<span class="glyphicon glyphicon-arrow-up torrent-up"></span>
{{item.torrent_seeds}}
</p>
<p class="no-margin-p" title="{{ 'TITLE_ALT.LEECHERS' | translate}}">
<span class="glyphicon glyphicon-arrow-down torrent-down"></span>
{{item.torrent_leechers}}
</p>
<p class="no-margin-p" title="{{ 'TITLE_ALT.FINISHED' | translate}}">
<span class="glyphicon glyphicon-ok torrent-finished"></span>
{{item.torrent_finished}}
</p>
</td>
<td class="col-md-1 td-v-middle text-center td-uploader">
<span ng-if="!item.isAnonymous" user-info="item.user" info-name></span>
<span ng-if="item.isAnonymous">{{ 'ANONYMOUS' | translate }}</span>
<div maker-info="item.maker"></div>
<!--<span vip-flag="item.user"></span>-->
<!--<span message-to="item.user" to-class="message-to-icon"></span>-->
</td>
</tr>
<tr ng-repeat-end>
<td class="td-progress" colspan="6">
<div torrent-progress="item.my_peers"></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="pagination-div-bottom">
<ul uib-pagination boundary-links="true" max-size="8" items-per-page="vm.torrentItemsPerPage" total-items="vm.torrentFilterLength"
ng-model="vm.torrentCurrentPage" ng-change="vm.torrentPageChanged()"
first-text="{{ 'PAGE_TEXT_FIRST' | translate}}" previous-text="{{ 'PAGE_TEXT_PREVIOUS' | translate}}"
next-text="{{ 'PAGE_TEXT_NEXT' | translate}}" last-text="{{ 'PAGE_TEXT_LAST' | translate}}">
</ul>
</div>
</div>
</section>